Wrangling categorical data in R [post]

Amelia McNamara, Nicholas J Horton
2017 unpublished
Data wrangling is a critical foundation of data science, and wrangling of categorical data is an important component of this process. However, categorical data can introduce unique issues in data wrangling, particularly in real-world settings with collaborators and periodically-updated dynamic data. This paper discusses common problems arising from categorical variable transformations in R, demonstrates the use of factors, and suggests approaches to address data wrangling challenges. For each
more » ... oblem, we present at least two strategies for management, one in base R and the other from the 'tidyverse.' We consider several motivating examples, suggest defensive coding strategies, and outline principles for data wrangling to help ensure data quality and sound analysis.
doi:10.7287/peerj.preprints.3163v1 fatcat:sdq3mivtpvfyhfdafgl6nhw7ny