Question 1

 x <- c("Use R!", "Data Science", "  ", ":)", "y = f(x)")

Write the code that will produce the single element vector “Use R!”

Question 2

Add an element to x consisting of the number exp(2) and print out the new vector x

Question 3

Let x <- c(2, 4, 6, 8, NA). Write an expression that will get rid of the fifth element. (Don’t retype out the vector without that element)

Question 4

Let x <- seq(3, 33, 3). Write an expression that will return the numbers of the third and ninth position.

Question 5

Let a <- c(“A”, “B”, “C”), b <- c(1, 2, 3), c <- list(a, b). Find the vector c(1, 2, 3)

Question 6

Let a <- c(“A”, “B”, “C”), b <- c(1, 2, 3), c <- list(a, b). Replace A with the letter B.

Question 7

Let x <- list(a=1:10, b=“Hey!”, c= c(T, F, T, F)), write an R statement to add d = “KC” to the list x.

Question 8

For the admits dataframe, create a vector called student3 which contains Student 0003’s High School and ACT Score

admits <- data.frame(ADMIT_ID = c(paste0("000", 1:9),"0010"), ACT = round(runif(10, 17, 34)), 
                     HIGH_SCHOOL_DESC = c("Blue Springs South", "Warrensburg High School", "Odessa R-VII SR High School", "Blue Springs South", "Lees Summit North High School", "Lees Summit West High School",
                                      rep("Warrensburg High School", 3), "Platt County R-III High School"), stringsAsFactors = FALSE)