6) Tables and Tidyverse-2

UC Berkeley, STAT 133, Fall 2024

๐Ÿ“– 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โ€:

๐Ÿ”ฌ 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.

Time permitting, weโ€™ll also 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(), and filter()
  • 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 10/04
  • HW5 released on 10/05, due 10/11