data visualization with r coursera week 1 quiz answers

Lesson 1: Data Visualization Tools and Packages

Practice Quiz

1. Which chart is a type of correlation chart?

  • Histogram
  • Pie chart
  • Bar chart
  • Scatterplot

2. Which R statement creates a chart object based on the data frame “salesdata”, but allows you to vary the aesthetics from one layer to another?

  • ggplot()
  • qplot()
  • ggplot(salesdata, aes(x = feature1, y = feature2))
  • ggplot(salesdata)

3. True or False: The qplot() function has no defaults so you have more control over the output.

  • True
  • False

Graded Quiz

4. Which R packages will this course use to create data visualizations?
Select two answers.

  • Leaflet

  • None, you will use base R
  • qplot
  • ggplot2

5. Which chart is a type of part to the whole chart?

  • Horizontal bar chart
  • Stacked bar chart
  • Grouped bar chart
  • Bar chart

6. Which ggplot2 function can create a complete plot given the data, mappings, and geom as parameters?

  • ggplot2()
  • geom()
  • qplot()
  • ggplot()

Lesson 2: Create Basic Charts with ggplot2

Practice Quiz

7. True or False: Numeric data can be qualitative or quantitative.

  • True
  • False

8. Which of the following statements about histograms is true? Select two answers.

  • A histogram displays quantitative data, while a bar chart displays qualitative data.

  • A histogram displays qualitative data, while a bar chart displays quantitative data.
  • A histogram counts the frequency of each individual number in the data set.
  • A histogram divides data into bins and then counts the number of times a data point falls into each bin.

9. Complete the sentence: A pie chart is the same as a ___________________________ in polar coordinates.

  • Grouped bar chart
  • Stacked bar chart
  • Horizontal bar chart
  • Bar chart

Graded Quiz

10. Which parameter of the qplot() function changes the border color of the bars in a bar chart to blue?

  • colour = I(“blue”)
  • fill = I(“blue”)
  • border = I(“blue”)
  • outline = I(“blue”)

11. How can you improve the smoothness of a histogram?

  • Always go with the default number of bins.
  • Reduce the number of bins to increase the bin width.
  • Increase the number of bins to reduce the bin width.
  • Changing the number of bins has no impact of the smoothness of the histogram.

12. What step must you take before you can add the coord_polar() function to ggplot() to create a pie chart?

  • Add the geom_bar(position = “stack”) command to the ggplot() function.
  • Add the geom_bar(position = “dodge”) command to the ggplot() function.
  • Set the x argument of the aes() function used in the ggplot() function to the factor.
  • Add the geom_circle() command to the ggplot() function.

Leave a Reply