LoslegenKostenlos loslegen

Summarizing by country

In the last exercise, you performed a summary of the votes within each year. You could instead summarize() within each country, which would let you compare voting patterns between countries.

Diese Übung ist Teil des Kurses

Case Study: Exploratory Data Analysis in R

Kurs anzeigen

Anleitung zur Übung

Change the code in the editor to summarize() within each country rather than within each year. Save the result as by_country.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Summarize by country: by_country
votes_processed %>%
  group_by(year) %>%
  summarize(total = n(),
            percent_yes = mean(vote == 1))
Code bearbeiten und ausführen