R Data Wrangling and Tables
r
data-wrangling
tidyverse
dplyr
purrr
excel
tables
dates
Guides and packages for cleaning data, working with dates, iterating with purrr, moving data in and out of Excel, and making tables in R.
This guide collects material for importing, cleaning, reshaping, and tabulating data in R. Begin with the three picks under Start here, then use the sections on cleaning, files, dates, iteration, Excel, and tables as your project needs them. Datasets and data guides to practice on are listed on the Data page.
Start here
- Tidy data — Vignette from the tidyr package explaining the tidy data format.
- A new data processing workflow for R: dplyr, magrittr, tidyr, ggplot2 — 2015 blog post describing a data-processing workflow built on these four packages.
- Data transformation cheatsheet (PDF) — Posit’s official data transformation cheatsheet with dplyr as a PDF.
Cleaning and validation
- janitor — Package of simple tools for cleaning data in R.
- How to Clean Data: {janitor} Package — R-Bloggers walkthrough of cleaning data with janitor.
- Quick Tips for Data Cleaning in R — R-Bloggers post of short tips for cleaning data in R.
- Getting Started with naniar — Vignette introducing naniar, a package for exploring missing data.
- validate — Package for checking data against validation rules.
- dplyr rename() - For Renaming Columns — Post on renaming data frame columns with dplyr’s rename function.
- R treasures: modifyList() — R-Bloggers post on base R’s modifyList function for updating lists.
Reading and writing files and databases
- vroom — Package for fast reading of delimited files.
- How data.table’s fread can save you a lot of time and memory — R-Bloggers post on reading large files with data.table’s fread, including input from shell commands.
- writexl — Light-weight package for writing data frames to xlsx files.
- fs — Package for file operations that work across operating systems.
- dirdf — Package that extracts metadata from directory and file names.
- wand — Package that guesses a file’s type.
- Working with databases in R — DataScience+ article on using databases from R.
- Databases using R: managing credentials — Page of Posit’s database guide on managing database credentials from R.
Dates and times
- Do more with dates and times in R — Vignette for lubridate, a package for working with dates and times.
- anytime — Package that converts many input formats to dates and date-times.
- Date Formats in R — R-Bloggers post on importing and formatting dates in R.
Iteration and functions
- Learn to purrr — Rebecca Barter’s tutorial on purrr, the tidyverse tool for iteration.
- purrr: Introduction and Application — Introduction to the purrr package (archived copy).
- Functionals, Advanced R — Chapter of Advanced R on functionals, functions that take other functions as arguments.
- Introducing the purrrplus package — Video introducing the purrrplus package for learning purrr.
- repurrrsive — Package of recursive list datasets for practicing purrr and list handling.
- zeallot — Package for assigning several variables from one result.
- transpose, R-statistics blog — Blog posts tagged transpose, on flipping rows and columns.
- Discover 7 Hidden Gems in the R Package Ecosystem — Video on seven lesser-known R packages.
R for Excel users
- ExcelFunctionsR — Package that implements Excel functions in R.
- Excel(ing) with R: Automating Excel — Towards Data Science article on reading, writing, merging, and splitting Excel files with R.
- R for Excel Users — Site for the book R for Excel Users, with a blog and online courses.
- How to do MID, RIGHT and LEFT in R — R for Excel Users post on the R equivalents of Excel’s text functions (archived copy).
Making tables
- tangram — Package that builds tables with a table grammar.
- texreg — Package that converts regression output to LaTeX or HTML tables.
- Make Beautiful Tables with the Formattable Package — R-Bloggers guide to the formattable package for styled tables.
- Top 7 Packages for Making Beautiful Tables in R — Towards Data Science comparison of seven packages for making tables.
Test data
- charlatan — Package that creates fake data in R, useful for tests and examples.