In this lab you can use the interactive console to explore or Knit the document. Remember anything you type here can be “sent” to the console with Cmd-Enter (OS-X) or Cntr-Enter (Windows/Linux) in an R code chunk.

# Part 1

1. create a new variable called my.num that contains 6 numbers
my.num = c(5,4,7,8,12,14)
1. mulitply my.num by 4
my.num * 4 
##  20 16 28 32 48 56
1. create a second variable called my.char that contains 5 character strings
my.char = c("Andrew", "John", "John", "Andrew","John")
1. combine the two variables my.num and my.char into a variable called both
both = c(my.num, my.char)
1. what is the length of both?
length(both)
##  11
1. what class is both?
class(both)
##  "character"

# Part 2

1. Divide both by 3, what happens?
both / 3
## Error in both/3: non-numeric argument to binary operator
1. create a vector with elements 1 2 3 4 5 6 and call it x
x = c(1,2,3,4,5,6)
1. create another vector with elements 10 20 30 40 50 and call it y
y =  c(10,20,30,40,50)
1. what happens if you try to add x and y together? why?
x + y
## Warning in x + y: longer object length is not a multiple of shorter
## object length
##  11 22 33 44 55 16
1. append the value 60 onto the vector y (hint: you can use the c() function)
y = c(y, 60)
1. add x and y together
x + y
##  11 22 33 44 55 66
1. multiply x and y together. pay attention to how R performs operations on vectors of the same length.
x * y
##   10  40  90 160 250 360