# a-1 Perform arithmetic operations for addition of 3 numbers 
3+4+5
## [1] 12
# a-2 subtraction of 1 number from another
4-3
## [1] 1
# a-3 multiplication of 2 numbers
3*4
## [1] 12
# a-4 division of one number by another
10/2
## [1] 5
# a-5 raising a number to the 4th power 
2^4
## [1] 16
# a-6 take the 3rd root of a number 
(8)^(1/3)
## [1] 2
# a-7 and log to the base 10 of a number
log10(11)
## [1] 1.041393
#b. Enter a vector of 6 numbers of your choosing into an object, c, using the assignment operator, <-.
c <- c(2,2,7,4,5,6)
#c. Print the 3rd element of c.
c [c(3)]
## [1] 7
#d. Print the length of vector c.
length(c)
## [1] 6
#e. Enter into d a matrix in which the first row contains the numbers 1, 3, 5, 7 and the second row contains 2, 4, 6, 8.
d <- matrix(c(1,2,3,4,5,6,7,8), nrow=2)
d
##      [,1] [,2] [,3] [,4]
## [1,]    1    3    5    7
## [2,]    2    4    6    8
#f. Assign to F the addition of 5 to each element in d. Print F.
F <- d+5
F
##      [,1] [,2] [,3] [,4]
## [1,]    6    8   10   12
## [2,]    7    9   11   13
#g. Print the dimensions of matrix F.
dim(F)
## [1] 2 4
#h. Assign 5.25 to k and ‘frank’ to m.
k <- 5.25
m <- 'frank'
#i. Check k and m to determine their data type.
k
## [1] 5.25
class(k)
## [1] "numeric"
#j. Convert k to an integer and assign the result to p. Print p to the console.
p <-as.integer(k)
p
## [1] 5
#k. Assign to G the conversion of k to a character. 
G <-as.character(k)

#Add 5.1 to G. Explain what happens and why.
G
## [1] "5.25"
class(G)
## [1] "character"