Tutorial 7
Tutorial 7
1. economics data set is a data set in the ggplot2 package which was produced from US economic time series
data. Using this data set and ggplot2 package do the following tasks:
a. Plot a line for the total population (pop), where the x-axis in the plot displays the month of data
collection (date).
b. Plot a line for the total population (pop) after 2005-01-01. Hint: use filter function in dplyr package.
2. diamonds data set is a data set in the ggplot2 package which contains the prices and other attributes of
almost 54,000 diamonds. Using this data set and ggplot2 package do the following tasks:
a. Plot a bar chart for quality of the cut (cut).
b. Plot a histogram and frequency polygon for weight of the diamond (carat).
c. Plot a histogram for weight of the diamond (carat) grouped by diamond clarity (clarity).
d. Plot a scatterplot to display values for weight of the diamond (carat) and the price (price).
e. Plot a scatterplot to display values for weight of the diamond (carat) and the price (price) grouped
by diamond color (color).
f. Plot a boxplot for weight of the diamond (carat) grouped by the quality of the cut (cut).