HDS 2.1-2.2

Author

Luke Busch

Loading R Packages

#install.packages("devtools")
#devtools::install_github("hellodata-science/hellodatascience")

#| warning: false #| Load Packages

#install.packages("tidyverse")
#install.packages("nycflights23")

Now you can load the packages you just installed. Insert the code for loading them here:

library("tidyverse")
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.6
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.1     ✔ tibble    3.3.0
✔ lubridate 1.9.4     ✔ tidyr     1.3.2
✔ purrr     1.2.0     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library('nycflights23')

Data Frames

tail('nycflights23')
[1] "nycflights23"

Getting to Know Data

Read Section 2.2 of Hello Data Science. Print the first few rows of the flights data (you certainly don’t want to print them all!):

library('nycflights23')
head('nycflights23')
[1] "nycflights23"

Use the glimpse function to get to know the variables in the flights data:

dplyr::glimpse('nycflights23')
 chr "nycflights23"

Describe how these two functions are similar and how they differ:

The glimpse function prints out each variable by name, whereas the heads and tail functions just print out the first and last 6 rows of the data set.