data visualization with r coursera week 2 quiz answers
Lesson 1: Basic Plots
Practice Quiz
1. True or False: A scatter plot can only show how two variables relate to each other across the points of the dataset.
- True
- False
2. When you create a line plot using multiple geom_line() statements, the y axis label reflects the y variable for which geom_line() statement?
- The last geom_line() statement.
- None of the geom_line() statements are used for the y-axis label.
- You specify this using an argument of the geom_line() function.
- The first geom_line() statement.
3. Which plot type summarizes the distribution of sorted numerical data?
- Bar charts
- Box plots
- Line plots
- Scatter plots
Graded Quiz
4. In a scatter plot, what is the best way to change the color of the points based on a categorical variable?
- Convert the categorical variable to a factor and then assign it to the “color” argument of the geom_point() function.
- Assign the variable to the “color” argument of the geom_point() function.
- Convert the categorical variable to a factor and then assign it to the “color” argument of the aes() function within the ggplot() function.
- Assign the variable to the “color” argument of the aes() function within the ggplot() function.
5. Which plot type helps you visualize time series data?
- Line plots
- Histograms
- Box plots
- Scatter plots
6. In a box plot, in which quartile does 50% of the sorted data fall below?
- First quartile
- Second quartile
- Third quartile
- Fourth quartile
Lesson 2: Customization and Maps
Practice Quiz
7. Which functions can you use to change the title of a plot? Select two answers.
- labs()
- ggtitle()
- xlab()
- ylab()
8. What can you add to a plot if you want to emphasize important elements, such as outliers or spikes in your data?
- Theme
- Annotation
- Plot title
- Axis label
9. You want to divide a plot into subplots based on a categorical variable called “quarters”. Which function should you add to ggplot() to do this?
- facet(quarters)
- facet_wrap(~quarters)
- facet_wrap(quarters)
- facet(~quarters)
10. What information do you need to provide to create a visualization using the Leaflet library?
- The latitude and longitude of each data point.
- The date associated with each data point.
- The percentage that each data point represents.
- Two items to compare to each other.
Graded Quiz
11. You added text labels to the data points on your plot, but now the plot looks messy because there are so many of them. What should you do?
- Set the overlap parameter of geom_text() to FALSE.
- Set the check_overlap parameter of geom_text() to TRUE.
- Set the check_overlap parameter of geom_text() to FALSE.
- Set the overlap parameter of geom_text() to TRUE.
12. If you do not specify a theme when creating a plot with ggplot2, which theme does it use by default?
- theme_classic()
- theme_minimal()
- theme_gray()
- theme_light()
13. Using themes, you can change the colors and styles of the borders, backgrounds, lines, and text on a plot. What should you do if you want to completely remove one of these elements from the theme?
- Assign the element.remove() function to the element.
- Assign the element.empty() function to the element.
- Assign the element.blank() function to the element.
- Assign the element.delete() function to the element.
14. In a Leaflet map, which two statements describe the difference between the addCircles() and addCircleMarkers() functions?
- Markers created with addCircleMarkers() can be rescaled.
- Markers created with addCircleMarkers() remain a constant size.
- Markers created with addCircles() remain a constant size.
- Markers created with addCircles() can be rescaled.