Notes on [introduction to R course on DataCamp](https://www.datacamp.com/courses/free-introduction-to-r)

```
# An addition
5 + 5
# A subtraction
5 - 5
# A multiplication
5 * 5
# A division
(5 + 5) / 2
# Exponentiation
2^5
# Modulo
28 %% 6
```

```
# Assign the value 42 to x
x <- 93
# Print out the value of the variable x
93
```

```
# Add value of 3 to my_cats
my_cats <- 3
# Print out the value of my_cats
my_cats
```

```
# Add value of 3 to my_cats and value of 2 to my_dogs
my_cats <- 3
my_dogs <- 2
# Create new variable of my_pets
my_pets <- my_cats + my_dogs
# Print out my_pets
my_pets
```

Integers, numerics, logical, and characters are four basic types of data when being introduced to R.

Integers are whole numbers and numerics are decimal numbers. Note that integers are also identified as numerics.

Logical values are (TRUE) or (FALSE).

Characters are "text" or sting.

```
# Variable ex_numeric to 2.5
ex_numeric <- 2.5
# Variable ex_integer to 2
ex_integer <- 2
# Variable ex_logical to TRUE
ex_logical <- TRUE
# Variable ex_text to "fun"
ex_text <- "fun"
```

```
# Define my_name variable with value of "Jane"
my_name <- "Jane"
# Create vector of logical values
logical_vector <- c(TRUE, TRUE, FALSE, TRUE, FALSE)
# Create vector of numerical values
race_winners <- c(3, 7, 8, 11, 15, 21, 32, 55, 60)
# Create vector of character values
types_wine <- c("Rose", "Merlot", "Chardonnay", "Pinot noir")
```

```
# Create two separate vectors
vector_one <- c(3, 7, 19, 22)
vector_two <- c(4, 11, 32, 23)
# Create new vector vector_total with sum of vectors
vector_total <- vector_one + vector_two
```

```
# Select element 3 from vector_one name it third_vc
third_vc <- vector_one[3]
# Select elements 1 3 and 4 from vector_two name it el_two
el_two <- vector_two[c(1, 3, 4)]
# Select elements from 1 to 3 from vector_one name is main_two
main_two <- vector_one[1:3]
```

## COMMENTS