Welcome! This is a workshop for the Cascadia R Conference that is meant to be a gentle introduction to data wrangling using the tidyverse
R packages. You’ll find there are lots of functions in the tidyverse
designed to help solve your common headaches when working with data and can even make data wrangling fun!
Please make sure to have this completed prior to the workshop beginning. Reading over all the materials here will help you get an understanding of what is to be expected and a better grounding to dive into the material as the workshop gets started. To participate in this workshop, you’ll need to do the following on your own laptops:
Have the following R packages installed: dplyr
, tidyr
, readr
, readxl
, haven
, gapminder
, and fivethirtyeight
This can be accomplished by copying the following code into the Console in RStudio and pressing Enter. Note that you’ll see quite a few lines of code run while the packages are installing. Don’t be alarmed. After the packages (and the packages they depend on) are done installing, you should see a >
waiting for you to enter something new waiting for you in the Console tab of RStudio.
After all of these packages are installed you should see them listed in the Packages tab in the bottom right section of RStudio.
install.packages(c("dplyr", "tidyr", "readr", "readxl", "haven", "gapminder", "fivethirtyeight"))
tidyverse
contains a variety of different packages that will be useful in your analysis and will be the focus of this workshop. We will focus ondplyr
package for data wrangling,tidyr
package for data reshaping,readr
, readxl
, and haven
packages for data importing.gapminder
package contains a data set made famous by Hans Rosling exploring data on the world’s countries.fivethirtyeight
package contains many datasets used by data journalists at FiveThirtyEight.com.Download the conference materials as a ZIP file and extract the files there as a folder on your computer. Note the importance of actually extracting all the files to a folder. This will be particularly important when we talk about importing files.
Double click on the gradual_data_wrangling.Rproj file in that folder to open up an RStudio project containing the files needed for the workshop. This might take a bit the first time. You’ll see gradual_data_wrangling-master
in the top right corner when it is ready to go.
You’ll be following along in the Part1-dplyr_intro.Rmd, Part2-loading_data.Rmd, and Part3-why_tidy_data.Rmd files, running the R code in the “chunks” there, and writing your own code to practice. You can also follow along with the webpage for the workshop at https://cascadiarconf-wrangle.netlify.com.
Remember, in this workshop we will adhere to the code of conduct for this conference. Be respectful of your fellow students, workshop leaders, and workshop TAs and let’s learn together.
dplyr
for data wrangling / summarizing
filter()
summarize()
group_by() %>% summarize()
mutate()
arrange()
%>%
to chain it all togetherreadxl
, readr
, and haven
packagestidyr
package to reshape/tidy/make data long