se <- function(x) sqrt(var(x) / length(x))
#3. convMeters(83.4, “feet”) # function is convMeters and 83.4 and “feet are the argument
#4. Use the recycling method to find v1+ v2:
v1 <- c(2, 5, 3 ,8 , 6)
v2 <- c(9, 7, 1)
v1 + v2
#5. 4. Factors provide an easy and compact form of handling what kind of data? ________
#6.
x <- factor( c(‘adult’, ‘adult’, ‘height’, ‘weight’, ‘adult’,
weight’, weight’, ‘height’)
x
table(x)
#7. Generate a sequence using the following: rep(12, 6). rep(12,6)
#8. Generate a sequence using the following: gl(3,4) gl(3,4)
#9. In the following statement, what do you call the objects, 2, 4, byrow = TRUE?
#10.
results <- matrix(c(10, 30, 50, 43, 56, 21, 30), 2, 4, byrow =
TRUE)
#11 Given the vector, a <- c(-8, -3, 0, 5, 10 21, 30), list the results of the following:
a <- c(-8, -3, 0, 5, 10, 21, 30)
a[-3]
a[ - (1:4)]
g <- c(67, 78, 45, 87, 57, 98, 95, 83, 74, 80, 55, 49)
g <- matrix(c( 67, 78, 45, 87, 57, 98, 95, 83, 74, 80, 55, 49), 3, 4)
g
g <- matrix(c( 67, 78, 45, 87, 57, 98, 95, 83, 74, 80, 55, 49), 3, 4, byrow = TRUE)
g
g[ 2, , drop = FALSE]
g[ , 3, drop = FALSE]
g
g1 <- matrix(c( 67, 78, 45, 87, 57, 98, 95, 83, 74, 80, 55, 49), 3, 4)
cbind(c(22, 34, 43) , g1[ ,3] )
results <- matrix(c(67, 78, 45, 87, 57, 98, 95, 83, 74, 80, 55, 49), 3, 4, byrow = TRUE)
colnames(results) <- c(“1st”. “2nd”, “3rd”, “4th”)
rownames(results) <- c(“car1”, “car2”, “car3”)
results
k <- array(1:12, dim = c(2, 3, 2))
k