R (Programming Language)
Q1. How does a matrix differ from a data frame?
Q2. What value does this statement return?
Q3. What do you use to take an object such as a data frame out of the workspace?
Q4. Review the following code. What is the result of line 3?
xvect <- "2"
Q5. The variable height is a numeric vector in the code below. Which statement returns the value 35?
Q6. In the image below, the data frame is named rates. The statement
sd(rates[, 2]) returns 39. As what does R regard Ellen’s product ratings?
Q7. Which choice does R regard as an acceptable name for a variable?
Q8. What is the principal difference between an array and a matrix?
Q9. Which is not a property of lists and vectors?
Q10. In the image below, the data frame on lines 1 through 4 is names StDf. State and Capital are both factors. Which statement returns the results shown on lines 6 and 7?
Q11. Which function displays the first five rows of the data frame named pizza?
Q12. You accidentally display a large data frame on the R console, losing all the statements you entered during the current session. What is the best way to get the prior 25 statements back?
Q13. d.pizza is a data frame. It’s column named temperature contains only numbers. If u extract temperature using the  accessors, its class defaults to numeric. How can you access temperature so that it retains the class of data.frame?
> class( d.pizza[ , "temperature" ] )
Q14. What does c contain?
a <- c(3,3,6.5,8)
b <- c(7,2,5.5,10)
c <- a < b
Q15. Review the statements below. Does the use of the dim function change the class of y, and if so what is y’s new class?
> y <- 1:9
> dim(y) <- c(3,3)
Q16. What is
mydf$y in this code?
mydf <- data.frame(x=1:3, y=c("a","b","c"), stringAsFactors=FALSE)
Q17. How does a vector differ from a list?
Q18. What statement shows the objects on your workspace?
Q19. What function joins two or more column vectors to form a data frame?
Q20. Review line 1 below. What does the statement in line 2 return?
1 mylist <- list(1,2,"C",4,5)
Q21. What is the value of y in this code?
Q22. Two variable in the mydata data frame are named Var1 and Var2. How do you tell a bivariate function, such as cor.test, which two variables you want to analyze?
deliver <- aggregate(count,by=list(area,driver), FUN=mean)
Q24. How to name rows and columns in DataFrames and Matrices F in R?
Q25. Which set of two statements-followed by the cbind() function-results in a data frame named vbound?
Q26. ournames is a character vector. What values does the statement below return to Cpeople?
Cpeople <- ournames %in% grep("^C", ournames, value=TRUE)
Q27. What is the value of names(v)?
v <- 1:3
names(v) <- c("a", "b", "c")
v <- 4
Q28. Which of the following statements doesn’t yield the code output below. Review the following code. What is the result of line 3?
x <- c(1, 2, 3, 4)
Output:  2 3 4
Q29. Given DFMerged <- merge(DF1, DF2) and the image below, how manu rows are in DFMerged?
DF1(data frame 1): DF2(data frame 2):
VarA VarB VarA VarD
1 1 2 1 18 21
2 4 5 2 19 22
3 7 8 3 20 23