6) Tables and Tidyverse-2
๐ Lecture
This week we continue with another fundamental tidyverse package "dplyr"
. Simply put, dplyr comes with functions that allow you to manipulate data-tables (e.g. data-frames, and other 2-dimensional objects) using a modern and syntactic way.
๐ Reading
Read chapters 5 to 10 of โR Tidy Hurricanesโ:
- https://www.gastonsanchez.com/R-tidy-hurricanes/2-02-intro-dplyr.html
- https://www.gastonsanchez.com/R-tidy-hurricanes/2-03-intro-pipes.html
- https://www.gastonsanchez.com/R-tidy-hurricanes/3-01-storms-year.html
- https://www.gastonsanchez.com/R-tidy-hurricanes/3-02-storms-1975.html
- https://www.gastonsanchez.com/R-tidy-hurricanes/3-03-amy-1975.html
- https://www.gastonsanchez.com/R-tidy-hurricanes/3-04-summary-1975.html
๐ฌ Lab
You will get to practice common manipulation operations of data-tables using a modern and syntactic way following the data plying framework provided by the R package dplyr.
Also, we are going to review various aspects that have to do with reading in (i.e. importing) tables in R.
๐ฏ Objectives
Perform basic manipulations on data tables with โdplyrโ functions:
- Select rows with
slice()
, andfilter()
- Select columns with
select()
- Transform columns with
mutate()
- Arrange rows with
arrange()
- Group data with
group_by()
- Summarize data with
summarize()
๐ Shiny Friday
The shiny app for this week uses the mtcars
data set to visualize the top-n cars given a selected variable.
- mtcars-topn-barchart: produces a simple barchartโvia
"ggplot2"
โto visualize the top-n cars given a selected variable. In addition to the plot, it also displays a table with the top-n cars. More important, this app uses a so-called reactive conductor element.
https://github.com/data133/shiny/tree/main/mtcars-topn-barchart
๐ Assignments
- HW4 due this 02/23
- HW5 released on 02/24, due 03/01