1. Which R function fits a simple linear regression model of x predicting y?

2. Suppose you need to randomly assign 100 study subjects into one of 5 groups such that there are exactly 20 subjects in each group. Which of the following R functions creates a variable Y that randomly distributes the 100 study subjects into 5 groups of equal size?

3. What is an appropriate syntax for a 'for' loop in R to run specific simulation code nnn times?

4. What does 'x:y' mean in R?

5. What does the following R code output? seq(2,10, by=2)

6. Given the command: Z <- array(h, dim=c(3,4,2)), dim(Z) stands for:

7. What's the output for command: print("Hello World")

8. What is the current proper style for assigning the numeric value 1 to a variable called "a"?

9. What is the value of x after executing the command: x <- 3 < 4

10. Which R function imports a comma separated file "X.csv"?

11. Which R code will sort the vector X <- c(1,5,3,9,7) from largest to smallest?

12. Which R function provides basic descriptive summary statistics for a numeric vector x?

13. Which R function provides a histogram of the numeric vector X?

14. How does one obtain the FIRST element of x when x <- 1:9?

15. What does the following R function output? abs(10 - 3 * 4)

16. The entities on which R operates are technically known as:

17. Which of the following is NOT a valid data import function?

18. Which command is used to test if an object is a time series?

19. In order to apply lag operator for the data, you should:

20. What is the default value for missing data that is read into R via read.table or read.csv?

21. What does the option 'cex' do in the following R function? text(0, 1, "Hello", cex=2)

22. In the plot( ) function, what option is used to specify that the x-axis displays values from 0 to 1?

23. What is the output of the following R code? x<-2; y <- c(1:3); paste("The value of x is", x, "and the value of y[x] is", y[x], sep=" ")

24. What's the output for command: seq(from = 1, to = 5, by = 3)

25. Which R function adds a line with slope 1 and intercept 0 into an existing plot of Y versus X?

26. What is the output of this command: > is.na( c( 1:3, NA ) )

27. Suppose we define X <- NA. What is the output for > is.nan( X ); is.na( X )

28. What is the value of Y? X <- c(1,2,2,2,3,3,4,4,5,6); Y <- unique(X[which(X<4)])

29. Which function is used to load a CSV file into R?

30. What R function can be used to tabulate values of categorical variable Y (columns) by categorical variable X (rows)?

31. What is the output for the command: is.na(0/0)?

32. What does the following R code output? Y <- c(1,2,3); X <- rep(c(1,length(Y)), times=2); X

33. What is the output of the following R function? yyy <- c(1, 3, NA); fff <- function(xxx) {mean(xxx)}; fff(yyy)

34. What is the output of dim(matrix(1:10, ncol=2))?

35. In a linear regression model with outcome y and linear predictors x1, x2, and x3, which R code correctly includes an interaction term between x1 and x2?

36. Which of the following is NOT included in CRAN's R distribution?

37. In order to assess whether x and y are equal, you can use the command:

38. Which R function will generate a mean for each row in a numeric matrix X with intermittent missing values?

39. Suppose numeric vectors X, Y, and Z are all of the same length. Which R command will create a matrix with rows X, Y, Z?

40. Which R command is used to merge two data sets X and Y by the variable "ID" that includes all records from both data sets?

41. Which object class can contain multiple unrelated object classes of potentially different sizes?

42. I want to use the sort() function, and I see in the help file that I my sort "an R object with a class, or a numeric, complex, character, or logical vector." Given this guidance, which is a valid call to sort()?

43. Which is NOT a valid R function for obtaining the residuals from a simple linear regression model of X predicting Y?

44. Let X be a 3x4 matrix with non-zero values. The result of: > apply(X, 2, mean), is:

45. Suppose X is the vector c(1:10). Which R code will swap the values of the 3rd element of X and the 7th element of X?

46. What is the output for the command: > is.na( NaN ) ?

47. What does the following R function output? xxx <- c(1, 1, 2, 2, 3, 3, NA, NA); yyy <- c(rep(0, 4), rep(1, 4)); cor(yyy, xxx)

48. Which R function can be used to produce a simple scatterplot of a numeric vector Y versus a numeric vector X?

49. What is the value of Y? Y <- 10 + 100 & !is.na(0)

50. Given the command: Z <- array(h, dim=c(3,4,2)), Z[] with an empty subscript or Z with no subscript stands for:

51. What is the output for the command: > rep( c(1:2), each = 3)

52. The function "rescale()" exists in both the plotrix and psych packages. How can I ensure that the plotrix version is used to scale my vector "X" to between 1 and 2?

53. What is the output of the command: paste("O", "M", "G")

54. Which is NOT the parameter of command seq()?

55. Which is an invalid way to return the mean of each variable in a numeric data frame?

56. Given x <- c(1:3,NA), the command: (x+1)[(!is.na(x)) & x>0] -> z generates:

57. Which class avoids making copies of objects?

58. What is the output of matrix(1:10, nrow=2)[2,2]?

59. Which R function fits a simple linear regression model of x predicting y without an intercept?

60. What's the output of the command : x <- c(T, T, NA); all(x, na.rm = TRUE)

61. Which R function will generate an integer X from Y <- "9.145", where Y is stored as a text string?

62. Which statement best characterizes the object generated with array( 1:30, dim = c(2,3,5) )

63. What is the result of command: labs <- paste(c("X","Y"), 1:10, sep="")?

64. Which operator performs modular conversion?

65. The command > t( matrix( 3:2, nrow=2 ) ) will generate:

66. Which is the fastest way to calculate groupwise means of a variable "x" for each level of a factor called "factor", given you have installed base R, data.table, and plyr?

67. matrix(1:4, ncol = 2)[1,]

68. Suppose we have defined a list object, "X", which has 3 components. Each component is a vector with at least 5 elements. Which command will extract the fourth (4th) element from the third (3rd) component of our list?

69. What is the output of the following calculation? t(c(1, 1)) %*% c(1, 1)

70. Let X be a n-dimension vector. Which call tests this particular statement: "no value of X is NA"

71. Arrays are similar to matrices in R, but are different in what respect?

72. What values are displayed for the x-axis limits of the following plot? plot(c(0, 2), c(0, 1), xaxt="n", yaxt="n"); axis(side=2, labels=c("0", "10"), at=c(0,1))

73. What is the output of: rrr <- 5.45667; sprintf("%1.f", round(rrr, 3))

74. If Y is a multi-modal vector of integers, which R function would return all modes of Y (the most frequent value(s) of Y)?

75. The command > Z <- array(h, dim=c(3,4,2)) would use h to set up 3 by 4 by 2 array in Z. However if h is shorter than 24, its values___________________.

76. R operates on named data structures. The simplest such structure is the numeric vector, which is a single entity consisting of an ordered collection of numbers. To set up a vector named x, consisting of 10.4, 5.6, 3.1, 6.4 and 21.7, which is the INCORRECT command:

77. Which R function outputs the day of the month from X <- "2014-May-15"?

78. Which will test the hypothesis that two independent Normally distributed random variables A and B have different means?

79. Given the command: Z <- array(h, dim=c(3,4,2)), Z[1:24] stands for:

80. Given this named vector "X": > X <- c( 5, 10, 1, 20 ); > names( X ) <- c( "a", "b", "c", "d" ); Which operation is valid to show the 2nd and 4th components of X?

81. All of the following will directly display the help file for the plot() function except:

82. What R function can be used to tabulate values of categorical variable Y (columns) by categorical variable X (rows), including missing values?

83. Which R code subsets a matrix Y to only those records (rows) where a variable x (in Y) is less than 100?

84. Which one is the correct expression regarding outer product of two arrays?

85. Which of the following is NOT one of R's basic vector types?

86. Which of the following statements regarding mixed vector and array arithmetic is true?

87. To test the residuals of a regression model X for heteroscedastisity, you can use this command:

88. Which is the INCORRECT way to get the vector [1 1 1 3 3 3 5 5 5]?

89. To test the residuals of model X for autocorrelation of first order, you can use this command:

90. Which is INCORRECT regarding the command: T <- 40; rnorm( T, 1, 4) ?

91. What is the result of command: z <- c(1:3,NA); ind <- is.na(z); z ?

92. How does a matrix differ from a data frame?

93. What value does this statement return? unclass(as.Date("1971-01-01"))

94. What do you use to take an object such as a data frame out of the workspace?

95. The variable height is a numeric vector in the code below. Which statement returns the value 35?

96. Which choice does R regard as an acceptable name for a variable?

97. What is the principal difference between an array and a matrix?

98. Which is not a property of lists and vectors?

99. Which function displays the first five rows of the data frame named pizza?

100. 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?

101. What is mydf$y in this code? mydf <- data.frame(x=1:3, y=c("a","b","c"), stringAsFactors=FALSE)

102. How does a vector differ from a list?

103. What statement shows the objects on your workspace?

104. What function joins two or more column vectors to form a data frame?

105. What is the value of y in this code? x <- NA; y <- x/1

106. 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?

107. How to name rows and columns in DataFrames and Matrices F in R?

108. Ournames is a character vector. What values does the statement below return to Cpeople? Cpeople <- ournames %in% grep("^C", ournames, value=TRUE)

109. How do you return "October" from x in this code? x<-as.Date("2018-10-01")

110. Which file contains settings that R uses for all users of a given installation of R?

111. If mdf is a data frame, which statement is true ?

112. A list can contain a list as an element. MyList has five columns, and the third column's item is a list of three items. How do you put all seven values in MyList into a single vector?

113. Which strings could be returned by the function ls(path = "^V")?

114. StDf is a data frame. Based on this knowledge, what does this statement return? StDf[, -1]

115. Which statement enables you to interactively open a single file?

116. How are these data types alike: logical, integer, numeric, and character?

117. What does the function power.anova.test return?

118. A variable whose type is numeric can contain which items?

119. What is the legitimate name of a data class in R?

120. How do you extract the values above the main diagonal from a square matrix named Rmat?

121. X is a vector of type integer, as shown on line 1 below. What is the type of the result returned by the statement > median(x)? x <- c(12L, 6L, 10L, 8L, 15L, 14L, 19L, 18L, 23L, 59L)

122. A list named a is created using the statement below. Which choice returns TRUE? a <- list("10", TRUE, 5.6)

123. Which function returns [1] TRUE FALSE TRUE? indat <- c("Ash Rd","Ash Cir","Ash St")