题目
题目

DATA1001/1901 (ND) Revision Quiz 2

单项选择题

The following data has been loaded into R Studio. str(actors) ## 'data.frame': 10 obs. of 2 variables: ## $ Actor : Factor w/ 10 levels "Adam Sandler",..: 6 5 9 2 7 3 1 4 8 10 ## $ X2019Income: num 89.4 76.4 66 65 58 57 57 43.5 41 35 Which code would produce a boxplot of X2019Income?

选项
A.library(tidyverse) ggplot(actors,aes(X2019Income)) + geom_boxplot()
B.library(tidyverse) ggplot(actors$X2019Income) + geom_boxplot()
C.library(tidyverse) ggplot(actors,aes(x=X2019Income),boxplot)
D.library(tidyverse) ggplot(actors,aes(x=X2019Income)) + geom_boxplot
查看解析

查看解析

标准答案
Please login to view
思路分析
The question asks which R code would produce a boxplot of the X2019Income variable from the actors data frame. First, recall that to plot a numeric variable with a boxplot using ggplot2, you typically specify the data frame in ggplot(), map the numeric variable to the y aesthetic (or x, depending on orientation), and add geom_boxplot(). In a standard vertical boxplot using ggplot2, you commonly do ggplot(data, aes(y = numeric_variable)) + geom_boxplot(). Option 1: library(tidyverse) ggplot(actors,aes(X2019Income)) + geom_boxplot() - Here, ggplot is given the aesthetics as aes(X2019Income) without naming the axis (neither x n......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

类似问题

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!