0
0
R Programmingprogramming~10 mins

Why customization creates professional visualizations in R Programming - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a basic scatter plot using ggplot2.

R Programming
library(ggplot2)
ggplot(mtcars, aes(x = wt, y = mpg)) + geom_[1]()
Drag options to blanks, or click blank then click option'
Ageom_point
Bscatter
Cpoint
Dpoint_geom
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'scatter' instead of 'point' inside geom_ function.
2fill in blank
medium

Complete the code to add a title to the plot.

R Programming
ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() + ggtitle([1])
Drag options to blanks, or click blank then click option'
A"mpg vs wt"
B'mpg vs wt'
Cmpg_vs_wt
Dmpg vs wt
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put quotes around the title text.
3fill in blank
hard

Fix the error in the code to change the color of points to blue.

R Programming
ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point(color = [1])
Drag options to blanks, or click blank then click option'
Ablue
B'blue'
Ccolor_blue
D"blue"
Attempts:
3 left
💡 Hint
Common Mistakes
Using color names without quotes causes errors.
4fill in blank
hard

Fill both blanks to customize the plot with a theme and axis labels.

R Programming
ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point(color = "blue") + [1]() + [2](title = "Car Data", x = "Weight", y = "Miles per Gallon")
Drag options to blanks, or click blank then click option'
Atheme_minimal
Blabs
Ctheme_classic
Dlabels
Attempts:
3 left
💡 Hint
Common Mistakes
Using labels() instead of labs().
5fill in blank
hard

Fill all three blanks to create a customized scatter plot with color, size, and theme.

R Programming
ggplot(mtcars, aes(x = wt, y = mpg, color = [1], size = [2])) + geom_point() + [3]()
Drag options to blanks, or click blank then click option'
Acyl
Bhp
Ctheme_light
Dtheme_dark
Attempts:
3 left
💡 Hint
Common Mistakes
Quoting variable names for color and size aesthetics.