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

Summarise output

While the summary() function is useful, it is limited to only the statistics built into that function. To get more specific statistics of interest, you've seen that the summarise(across(everything(), list())) syntax from the dplyr package can be used.

In this exercise, you will use summarise(across(everything(), list())) to compute the mean, standard deviation, median, minimum and maximum of the abalone diameters. You will save the output and then extract specific elements.

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. Save the output as abdiam.
  • Use str() structure function to view the class type of abdiam and the names of the elements in abdiam.
  • Use the $ operator to select and display the diameter_sd element stored in abdiam.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Save output from summarise() for diameter
abdiam <- ___ %>% 
  select(___) %>%
  summarise(across(___, list(___ = ~mean(.x),
                                      ___ = ~sd(.x),
                                      median = ___,
                                      min = ___,
                                      ___ = ~max(.x))))

# Use str() to see class of abdiam and names of elements
___

# Use $ selector to display diameter_sd 
___
Kodu Düzenle ve Çalıştır