MulaiMulai sekarang secara gratis

Who won?

The iran dataset contains all of the votes cast in this election, meaning that you can find the victor by computing the total number of votes for each candidate. In addition to answering the question of who won nationwide, you can also see how the results differed by province.

Along the way, you'll use a very useful function called gather(). This allows you to reshape your data frame by taking information stored in variable names and moving it to live in its own column.

Latihan ini adalah bagian dari kursus

Inference for Categorical Data in R

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Compute and save candidate totals
totals <- ___ %>%
  ___(ahmadinejad = ___,
            rezai = ___,
            karrubi = ___,
            mousavi = ___)

# Inspect totals
totals
Edit dan Jalankan Kode