Aan de slagGa gratis aan de slag

Descriptive statistics output

Up to now, you've only printed your output to the console. In this exercise, you will save your output from both the summary() and psych::describe() functions for descriptive statistics of the abalone weight measurements.

First, you will save output from the summary() function, which is a table class object. Elements from table objects can be selected using the [row, col] syntax.

Next you will save the output from the psych::describe() function. This output is a customized class type called psych describe, which is also a data.frame class. So, elements of psych::describe() output can be extracted using the $ operator to select elements by name from this output.

The abaloneKeep dataset, dplyr and psych packages have been loaded for you.

Deze oefening maakt deel uit van de cursus

R For SAS Users

Cursus bekijken

Oefeninstructies

  • Save summary stats for whole weight, shucked weight and shell weight in abaloneKeep as absummary.
  • Display columns 1 to 2 out of absummary.
  • Get descriptive statistics of abalone whole weight, shucked weight, and shell weight in abaloneKeep using psych::describe() and save output as abpsych.
  • Display the mean absolute deviation mad from abpsych.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Save summary stats output for 3 requested weights
absummary <- ___ %>% 
  select(___) %>% 
  ___

# Pull columns 1 to 2 out of absummary
absummary[,___]

# Save describe from psych output for weights as abpsych
abpsych <- ___ %>%
  ___ %>%
  ___

# Display the mad element from abpsych
___
Code bewerken en uitvoeren