Questions
Questions

DATA1001/1901 (ND) Revision Quiz 2

Single choice

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?

Options
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
View Explanation

View Explanation

Verified Answer
Please login to view
Step-by-Step Analysis
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

Log in for full answers

We've collected over 50,000 authentic exam questions and detailed explanations from around the globe. Log in now and get instant access to the answers!

Similar Questions

More Practical Tools for Students Powered by AI Study Helper

Join us and instantly unlock extensive past papers & exclusive solutions to get a head start on your studies!