Oh the Summaries …

Lab 2B

Directions: Follow along with the slides and answer the questions in red font in your journal.

Just the beginning

Extreme values

Calculating a range value

Introducing custom functions

Example function

mm_diff <- function(variable, data) {
  mean_val <- mean(variable, data = data)
  med_val <- median(variable, data = data)
  abs(mean_val - med_val)
}

Using mm_diff()

____(~____, data = ____)

Our first function

____ <- function (____, ____) {
  values <- range(____, data = ____)
  diff(___)
}

Quartiles (Q1 & Q3)

quantile(~____, data = ____, p = 0.25)

The Inter-Quartile-Range (IQR)

Calculating the IQR

Boxplots

Our favorite summaries

favstats(~____, data=colors)

On your own