dlab-berkeley / R-Data-Wrangling

D-Lab's 4 hour two-part workshop on data wrangling in R using tidyverse.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

D-Lab Data Wrangling Workshop

DataHub License: CC BY 4.0

This repository contains the materials for D-Lab's Data Wrangling workshop.

Prerequisites

We recommend attending D-Lab's R Fundamentals series prior to this workshop.

Check D-Lab's Learning Pathways to figure out which of our workshops to take!

Workshop Goals

In this workshop, we provide practical guidance on data wrangling using R's tidyverse suite of packages. In Part 1, we cover how to transform tidydata in order to perform data analysis and visualization. In Part 2, we cover how to wrangle messy data into tidy data.

Learning Objectives

After this workshop, you will be able to:

  1. Use tidyverse functions for transforming your data to be used for visualization and analysis

  2. Identify how an "untidy" dataframe gets in the way of data visualization and analysis

  3. Use pivot_longer and pivot_wider to wrangle a dataframe into "tidy" form, and join multiple dataframes

This workshop does not cover the following:

  • Data visualization in R (this is covered in D-Lab's R Data Visualization workshop)
  • Advanced data analysis in R, such as machine learning (this is covered in D-Lab's R Machine Learning workshop)

⚠️ At the start of the workshop we will install R, RStudio and the workshop materials from this repository. If you want to do that yourself beforehand, please follow the instructions below.

Installation Instructions

We will use RStudio to go through the workshop materials, which requires installation of both the R language and the RStudio software.

  1. Download R: Follow the links according to the operating system that you are running. Download the package, and install R onto your compute. You should install the most recent version (at least version 4.3).

  2. Download RStudio: Install RStudio Desktop. This should be free. Do this after you have already installed R. The D-Lab strongly recommends an RStudio edition of 2022.02.0+443 "Prairie Trillium" or higher. Check RStudio is working by opening up the program.

  3. Download these workshop materials:

    • Click the green "Code" button in the top right of the repository information.

    • Click "Download Zip".

    • Extract this file to a folder on your computer where you can easily access it (we recommend Desktop).

  4. Optional: If you are familiar with git, you can instead clone this repository by opening a terminal and entering

Is RStudio not working on your computer?

If R/RStudio is not installing correctly or you do not wish to download these programs to your laptop, we strongly recommend using the UC Berkeley Datahub to run the materials for these lessons. You can access the DataHub by clicking the following button:

DataHub

The DataHub downloads this repository, along with any necessary packages, and allows you to run the materials in an RStudio instance on UC Berkeley's servers. No installation is necessary from your end - you only need an internet browser and a CalNet ID to log in. By using the DataHub, you can save your work and come back to it at any time. When you want to return to your saved work, just go straight to the D-Lab DataHub, sign in, and you click on the [Workshop-Name] folder.

Additional Resources

Check out the following resources to learn more about data wrangling in R:

  • R for Data Science: A comprehensive online textbook by Hadley Wickham, who helped develop tidyverse

About the UC Berkeley D-Lab

D-Lab works with Berkeley faculty, research staff, and students to advance data-intensive social science and humanities research. Our goal at D-Lab is to provide practical training, staff support, resources, and space to enable you to use R for your own research applications. Our services cater to all skill levels and no programming, statistical, or computer science backgrounds are necessary. We offer these services in the form of workshops, one-to-one consulting, and working groups that cover a variety of research topics, digital tools, and programming languages.

Visit the D-Lab homepage to learn more about us. You can view our calendar for upcoming events, learn about how to utilize our consulting and data services, and check out upcoming workshops.

Other D-Lab R Workshops

Here are other R workshops offered by the D-Lab:

Basic R

R Fundamentals

Intermediate/Advanced Competency

R Data Visualization

R Machine Learning (links to the pilot)

R Deep Learning

Contributors

Hero Ashman

About

D-Lab's 4 hour two-part workshop on data wrangling in R using tidyverse.


Languages

Language:R 100.0%