### Data Visualization with R | Week 2

These are answers for Data Visualization with R Week 2

## Practice Quiz – 1

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?

None of the geom_line() statements are used for the y-axis label.

The first geom_line() statement.

The last geom_line() statement.

You specify this using an argument of the geom_line() function.

3. Which plot type summarizes the distribution of sorted numerical data?

Box plots

Scatter plots

Line plots

Bar charts

1. 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 aes() function within the ggplot() 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 geom_point() function.

2. Which plot type helps you visualize time series data?

Box plots

Histograms

Scatter plots

Line plots

3. In a box plot, in which quartile does 50% of the sorted data fall below?

First quartile

Second quartile

Third quartile

Fourth quartile

These are answers for Data Visualization with R Week 2

## Practice Quiz – 2

1. Which functions can you use to change the title of a plot? Select two answers.

ggtitle()

xlab()

labs()

ylab()

2. What can you add to a plot if you want to emphasize important elements, such as outliers or spikes in your data ?

Axis label

Plot title

Theme

Annotation

3. 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(quarters)

facet_wrap(quarters)

4. What information do you need to provide to create a visualization using the Leaflet library?

The latitude and longitude of each data point.

The percentage that each data point represents.

Two items to compare to each other.

The date associated with each data point.

These are answers for Data Visualization with R Week 2

1. 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 check_overlap parameter of geom_text() to TRUE.

Set the 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 FALSE.

2. 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()

3. 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.blank() function to the element.

Assign the element.empty() function to the element.

Assign the element.delete() function to the element.

4. In a Leaflet map, which two statements describe the difference between the addCircles() and addCircleMarkers() functions?

Markers created with addCircleMarkers() remain a constant size.

Markers created with addCircles() remain a constant size.

Markers created with addCircleMarkers() can be rescaled.

Markers created with addCircles() can be rescaled.

* The material and content uploaded on this website are for general information and reference purposes only. Please do it by your own first. COPYING MATERIALS IS STRICTLY PROHIBITED.

These are answers for Data Visualization with R Week 2