x <- c("Use R!", "Data Science", " ", ":)", "y = f(x)")
Write the code that will produce the single element vector “Use R!”
Add an element to x consisting of the number exp(2) and print out the new vector x
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)
Let x <- seq(3, 33, 3). Write an expression that will return the numbers of the third and ninth position.
Let a <- c(“A”, “B”, “C”), b <- c(1, 2, 3), c <- list(a, b). Find the vector c(1, 2, 3)
Let a <- c(“A”, “B”, “C”), b <- c(1, 2, 3), c <- list(a, b). Replace A with the letter B.
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.
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)