BaşlayınÜcretsiz Başlayın

Aggregations with rowwise()

rowwise() can be a handy tool in your dplyr programming toolbox when combined with c_across(). Together, they allow you to perform calculations across different variables on each row. For example, this can be useful for counting missing values across each row for chosen variables.

Bu egzersiz

Programming with dplyr

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Set the pipeline up for calculations across each row.
  • Create a column num_missing that contains each row's number of missing values in the columns gdp_in_billions_of_usd through to the last column in imf_data.
  • Sort the results by number of missing entries in decreasing order.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

imf_data %>% 
  # Specify that calculations are done across the row
  ___() %>% 
  # Count missings in gdp_in_billions_of_usd to last column
  mutate(num_missing = sum(is.na(
    ___(___:___))
  )) %>% 
  select(country:year, num_missing) %>% 
  # Arrange by descending number of missing entries
  ___
Kodu Düzenle ve Çalıştır