题目
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道考试原题与详细解析,现在登录,立即获得答案。
类似问题
For the data represented by the boxplot above, the percentage of data values greater than 65 is:
You are a newly employed data scientist working at Google! Your team is responsible for analysing user engagement. One of the key metrics your team tracks is the number of daily active users (DAUs) across different regions. You have the dataset, google_dau, which contains the following columns: Date: Date of the observation (e.g. 2024-07-01, 2024-07-02...) Region: Region of the users (North America, Europe, Asia) DAUs: Number of daily active users (e.g. 10000, 11000...) What code best matches the following graph (assuming you have loaded the necessary packages)?
You are a newly employed data scientist working at Google! Your team is responsible for analysing user engagement. One of the key metrics your team tracks is the number of daily active users (DAUs) across different regions. You have the dataset, google_dau, which contains the following columns: Date: Date of the observation (e.g. 2024-07-01, 2024-07-02...) Region: Region of the users (North America, Europe, Asia) DAUs: Number of daily active users (e.g. 10000, 11000...) What code best matches the following graph (assuming you have loaded the necessary packages)?
Determine whether this statement is True or False or Can't Tell. A boxplot is a useful summary of a bimodal distribution. False
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!