Identifying R Functions & Packages Used in GitHub Repos

[This article was first published on rstats on Bryan Shalloway's Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

TLDR: funspotr provides helpers for spotting the functions and packages in R and Rmarkdown files and associated github repositories. See Examples for catalogues of the functions/packages used in posts by Julia Silge, David Robinson, and others.

Documenting #rstats posts

I was inspired by a few tweets I saw documenting the methods used in posts by popular #rstats communicators/developers:

As a complement to these resources, I thought it’d be helpful to see precisely which functions and packages were used in each post. See Julia Silge Blog and David Robinson Tidy Tuesday for tables containing the unique functions and associated packages used in each of their posts. I also created tables for functions in the R for Data Science Chapters and Bryan Shalloway Blog.

These Examples were made using the funspotr package that provides helpers for identifying R functions & packages in self-contained R files and associated github repositories. See funspotr website for documentation on how to apply funspotr to #rstats file(s) or repos1 as well as to see how the package works and current limitations. Message me if you use funspotr or feel free to open an issue if you’d be interested in adding additional funspotr-examples that I can link to!

Examples

The files in the github repos below were parsed and saved in funspotr-examples2 – specifically using R/save-examples.R to parse each file and record each instance of a function’s use to data/funs3.

Below, I only return the first use of a function in each post4 – except for R for Data Science Chapters where I only show the first use of a function across the entire book5.

library(dplyr)
library(readr)
library(DT)

Julia Silge Blog

Also posted table to google drive here.

The following package dependencies were not installed locally during parsing. Any function from these packages (along with any custom functions) will most likely be assigned pkgs = "(unknown)":
Lingua; EN; silgelib; packagesurvey; drlib; sqlstackr; tvthemes; parttree

readr::read_csv("https://raw.githubusercontent.com/brshallo/funspotr-examples/main/data/funs/jsilge-blog-funs-20220114.csv") %>% 
  distinct() %>% 
  DT::datatable(rownames = FALSE,
              class = 'cell-border stripe',
              filter = 'top',
              escape = FALSE,
              options = list(pageLength = 10))

To leave a comment for the author, please follow the link and comment on their blog: rstats on Bryan Shalloway's Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)