R Quiz (Quiz #3)
This exam consists of nine multiple choice questions. For each, circle the letter corresponding to the best answer. You are not permitted to look at any papers, books, or other material during this test.
- Which of the following statements in R are "legal" (i.e., will not generate an error)
- 1 = 2
- z = x > y
- x == x
- Consider the following data frame:
n s b 1 1 6 aa 2 5 9 aa 3 7 3 bb 4 9 7 bb 5 2 12 ccIf I execute the following command in R, what will result?
mysel = df[df$n<=7,]
- mysel will contain a copy of df
- mysel will contain a copy of the df data frame with all rows where n is less than or equal to 7 dropped
- mysel will contain a copy of the df data frame with all rows where n is less than to 7 dropped
- mysel will be a vector of numbers less then 7
- Referring to the data frame defined above, how to you access the "b" column? Check all that will work
- Why do you have a separate script file for R?
- So you can turn in your assignment at the end of the lab
- It is required for R to function
- To organize your code and help you reconstruct your analysis steps later
- If a line in a script or command begins with a '#' character, what does it mean?
- Perform a t-test
- The line will be ignored
- Select the column indicated by the next command
- What is the "working directory" in R?
- The directory that the R interpreter is currently "looking at". Filenames are relative to this folder
- The place with R's configuration files are stored
- The place with files must be saved in order to be used with R
- How do you check the contents of a variable in R? (e.g., suppose you wanted to see what is "inside" a variable named 'mydata')
- Type 'mydata' on a line by itself into the R interpreter/interactive session
- How do you check the current working directory that R is using
- Using the data frame defined above, what would happen if you execute the following command:
- a vector c(3, 8, 2) which is the mean of the values in column n that share the same value on column b
- a matrix containing all the data in the frame
- a vector like c(1,5,7,9)
- the values in column s