Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
UBC-DSCI
GitHub Repository: UBC-DSCI/dsci-100-assets
Path: blob/master/2019-fall/slides/03_tutorial_class_activity.ipynb
2051 views
Kernel: R
library(tidyverse) passengers <- read_csv("data/AirPassengers.csv")
── Attaching packages ─────────────────────────────────────── tidyverse 1.2.1 ── ggplot2 3.2.0 purrr 0.3.2 tibble 2.1.3 dplyr 0.8.3 tidyr 0.8.3 stringr 1.4.0 readr 1.3.1 forcats 0.4.0 ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ── dplyr::filter() masks stats::filter() dplyr::lag() masks stats::lag() Parsed with column specification: cols( Year = col_double(), Jan = col_double(), Feb = col_double(), Mar = col_double(), Apr = col_double(), May = col_double(), Jun = col_double(), Jul = col_double(), Aug = col_double(), Sep = col_double(), Oct = col_double(), Nov = col_double(), Dec = col_double() )

Class activity 1:

The airpassenger data set contains the monthly totals of international airline passengers from 1949 to 1960. If we are interested in asking whether year or month has a relationship with the number of monthly international airline passengers would we consider the data below tidy? True or false?

head(passengers)

Class activity 2:

Use the tidyverse functions to make this data set ________.

# answer goes here

Class activity 3:

Use the tidyverse function spread to transform the data set to its original state:

# answer goes here