The goal of tidycode is to allow users to analyze R expressions in a tidy way.

Installation

You can install tidycode from CRAN with:

install.packages("tidycode")

You can install the development version of tidycode from github with:

Example

Read in existing code

Using the matahari package, we can read in existing code, either as a string or a file, and turn it into a matahari tibble using matahari::dance_recital().

Alternatively, you may already have a matahari tibble that was recorded during an R session.

Load the tidycode library.

library(tidycode)

We can use the expressions from this matahari tibble to extract the names of the packages included.

Create a data frame of your expressions, splitting each into individual functions.

Add in the function classifications!

We can also remove a list of “stopwords”. We have a function, get_stopfuncs() that lists common “stopwords”, frequently used operators, like %>% and +.