list_files_github_gists {funspotr}R Documentation

List Github Gists of User

Description

Given a username, return a dataframe with paths to all the gists by that user.

Usage

list_files_github_gists(
  user,
  pattern = stringr::regex("(r|rmd|rmarkdown|qmd)$", ignore_case = TRUE)
)

Arguments

user

Character string of username whose github gists you want to pull.

pattern

Regex pattern to keep only matching files. Default is stringr::regex("(r|rmd|rmarkdown|qmd)$", ignore_case = TRUE) which will keep only R, Rmarkdown and Quarto documents. If you have a lot of .md gists that can be converted to .R files you may want to edit this argument. To keep all files use ".".

Value

Dataframe with relative_paths and absolute_paths of file paths. Because gists do not exist in a folder structure relative_paths will generally just be a file name. absolute_paths a url to the raw file. See unnest_results() for helper to put into an easier to read format.

See Also

list_files_github_repo(), list_files_wd()

Examples


library(dplyr)
library(funspotr)

# pulling and analyzing my R file github gists
gists_urls <- list_files_github_gists("brshallo", pattern = ".")

# Will just parse the first 2 files/gists
# Note that is easy to hit the API limit if have lots of gists
contents <- filter(gists_urls, str_detect_r_docs(absolute_paths)) %>%
  slice(1:2) %>%
  spot_funs_files()


contents %>%
  unnest_results()


[Package funspotr version 0.0.4 Index]