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

Group_by output

For this exercise, you will continue where you left off in the last exercise working with summarise(across(everything(), list())) syntax from the dplyr package. This time, however, you will add the group_by() function to produce custom summary statistics for abalone diameters by sex group.

The abaloneKeep dataset and dplyr package have been loaded for you.

Bu egzersiz

R For SAS Users

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

Egzersiz talimatları

  • Use summarise(across(everything(), list())) syntax to compute the mean, standard deviation, median, minimum, and maximum of diameter from abaloneKeep by sex using group_by(). Save the output as absexdiam.
  • Use the str() structure function to view the class type of absexdiam, names of the elements in absexdiam, and dimensions.
  • Use the filter function to extract the row for sex equal to "I" from absexdiam.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Save output from summarise() for diameter by sex
___ <- abaloneKeep %>% 
  group_by(___) %>%
  select(___, ___) %>%
  summarise(___(everything(), list(mean = ___,
                                      ___ = ~sd(.x),
                                      median = ~median(.x),
                                      min = ___,
                                      ___ = ___)))

# Get structure of absexdiam
___

# Use filter() function to extract row for sex == "I"
___ %>% filter(___)
Kodu Düzenle ve Çalıştır