Download the PDF of the presentation
[ The R Script associated with this page is available here](scripts/03_DataWrangling.R). Download this file and open it (or copy-paste into a new script) with RStudio so you can follow along. # RStudio Shortcuts ## Running code * `ctrl-R` (or `command-R`) to run current line * Highlight `code` in script and run `ctrl-R` (or `command-R`) to run selection * Buttons:
## Switching windows
* `ctrl-1`: script window
* `ctrl-2`: console window
> Try to run today's script without using your mouse/trackpad
# Data wrangling
## Useful packages: [`tidyverse`](https://www.tidyverse.org/packages/)
[Cheat sheets on website](https://www.rstudio.com/resources/cheatsheets/) for [Data Wrangling](https://www.rstudio.com/wp-content/uploads/2015/02/data-wrangling-cheatsheet.pdf)
```r
library(tidyverse)
```
Remember use `install.packages("tidyverse")` to install a new package.
### Example operations from [here](https://cran.rstudio.com/web/packages/dplyr/vignettes/introduction.html)
## New York City Flights
Data from [US Bureau of Transportation Statistics](http://www.transtats.bts.gov/DatabaseInfo.asp?DB_ID=120&Link=0) (see `?nycflights13`)
```r
library(nycflights13)
```
Check out the `flights` object
```r
head(flights)
```
```
## # A tibble: 6 x 19
## year month day dep_time sched_dep_time dep_delay arr_time
##