Plotting a line over time
In the last chapter, you learned how to summarize() the votes dataset by year, particularly the percentage of votes in each year that were "yes".
You'll now use the ggplot2 package to turn your results into a visualization of the percentage of "yes" votes over time.
Bu egzersiz, kursun bir parçasıdır
Case Study: Exploratory Data Analysis in R
Egzersiz talimatları
The by_year dataset has the number of votes and percentage of "yes" votes each year.
- Load the
ggplot2package. - Use
ggplot()with thegeom_linelayer to create a line plot withyearon the x-axis andpercent_yeson the y-axis.
Uygulamalı etkileşimli egzersiz
Bu egzersizi bu örnek kodu tamamlayarak deneyin.
# Define by_year
by_year <- votes_processed %>%
group_by(year) %>%
summarize(total = n(),
percent_yes = mean(vote == 1))
# Load the ggplot2 package
# Create line plot
___(by_year, ___) ___
___