Tools for Analyzing R Code the Tidy Way

With the current emphasis on reproducibility and replicability, there is an increasing need to examine how data analyses are conducted. In order to analyze the between researcher variability in data analysis choices as well as the aspects within the data analysis pipeline that contribute to the variability in results, we have created two R packages: matahari and tidycode. These packages build on methods created for natural language processing; rather than allowing for the processing of natural language, we focus on R code as the substrate of interest. The matahari package facilitates the logging of everything that is typed in the R console or in an R script in a tidy data frame. The tidycode package contains tools to allow for analyzing R calls in a tidy manner. We demonstrate the utility of these packages as well as walk through two examples.

Lucy D’Agostino McGowan , Sean Kross , Jeffrey Leek
2020-09-10

Supplementary materials

Supplementary materials are available in addition to this article. It can be downloaded at RJ-2020-011.zip

CRAN packages used

matahari, tidycode, tidyverse, tidytext, dplyr, purrr, wordcloud, data.table, gh

CRAN Task Views implied by cited packages

NaturalLanguageProcessing, Databases, Finance, HighPerformanceComputing, ModelDeployment, TimeSeries, WebTechnologies

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

McGowan, et al., "Tools for Analyzing R Code the Tidy Way", The R Journal, 2020

BibTeX citation

@article{RJ-2020-011,
  author = {McGowan, Lucy D’Agostino and Kross, Sean and Leek, Jeffrey},
  title = {Tools for Analyzing R Code the Tidy Way},
  journal = {The R Journal},
  year = {2020},
  note = {https://doi.org/10.32614/RJ-2020-011},
  doi = {10.32614/RJ-2020-011},
  volume = {12},
  issue = {1},
  issn = {2073-4859},
  pages = {226-242}
}