Oh the Summaries …

Lab 2B

Directions: Follow along with the slides, completing the questions in blue on your computer, and answering the questions in red in your journal.

Space, Click, Right Arrow or swipe left to move to the next slide.

Just the beginning

Extreme values

Quartiles (Q1 & Q3)

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

The Inter-Quartile-Range (IQR)

Calculating the IQR

Boxplots

Our favorite summaries

favstats(~____, data = colors)

Calculating a range value

values <- range(~____, data=colors)
diff(values)

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(___)
}

On your own