knitr::opts_chunk$set(echo = TRUE)

library(tidyverse)
library(openintro)

Base R vs Tidyverse

One of the major differences between base R and Tidyverse is the use of the pipe operator, %>%, from the magrittr package. Starting with R version 4.0, there is a native (i.e. base R) pipe operator, |>. However, it behaves differently from the magrittr pipe. For the problems below, use the magrittr pipe for the Tidyverse problems and either the native pipe or no pipe for base R.

Problem One:

Calculate the average number of study hours per week with base R and Tidyverse.

#INSERT YOUR CODE HERE

Challenge:

Calculate the standard deviation for both variables with base R and Tidyverse.

#INSERT YOUR CODE HERE

For the plots below, use the ggplot2 package from the Tidyverse.

Problem Two:

Sketch a histogram for the study_hours variable.

#INSERT YOUR CODE HERE

Challenge:

Sketch a boxplot for each variable.

#INSERT YOUR CODE HERE


npaterno/stat231 documentation built on May 1, 2023, 6:07 p.m.