Basic R Programs for Beginners
Basic R Programs for Beginners - Important Points
11. | What is the output of the following R code snippet? x <- c(1, 2, 3, 4, 5) |
---|
A. A summary of the x and y vectors, including the mean, median, and quartiles of x.
B. A summary of the x and y vectors, including the number of missing values in each column.
C. A summary of the z data frame, including the number of observations, the mean, median, and quartiles of x, and the counts and percentages of each unique value of y.
D. Error
View Answer Discuss Work SpaceAnswer: option c
Explanation:
12. | What is the output of the following R code snippet? x <- c(1, 2, 3, 4, 5) |
---|
A. A scatterplot of x vs y.
B. A line plot of x vs y.
C. A bar plot of x vs y.
D. Error
View Answer Discuss Work SpaceAnswer: option a
Explanation:
13. | What is the output of the following R code snippet? x <- c(1, 2, 3, 4, 5) |
---|
A. A data frame with two columns: x and y, containing the rows where x is greater than 3.
B. A data frame with two columns: x and y, containing the rows where y is greater than 3.
C. A data frame with two columns: x and y, containing the rows where x and y are greater than 3.
D. Error
View Answer Discuss Work SpaceAnswer: option a
Explanation:
14. | What is the output of the following R code snippet? x <- c(1, 2, 3, 4, 5) |
---|
A. A data frame with three columns: x, y, and x_squared, containing the original x and y columns, and a new column x_squared with the squares of the x values.
B. A data frame with two columns: x and y, containing the original x and y columns, and no new columns.
C. An error message, because the mutate function can only be used on numeric columns.
D. An error message, because the ^ operator cannot be used on vectors.
View Answer Discuss Work SpaceAnswer: option a
Explanation:
15. | What is the output of the following R code snippet? x <- c(1, 2, 3, 4, 5) |
---|
A. A data frame with two columns: mean_x and sd_x, containing the mean and standard deviation of the x values in the z data frame.
B. A data frame with three columns: x, y, and mean_x, containing the original x and y columns, and a new column mean_x with the mean of the x values.
C. An error message, because the summarize function can only be used on grouped data.
D. An error message, because the mean and sd functions cannot be used on character columns.
View Answer Discuss Work SpaceAnswer: option a
Explanation: