Skip to contents

spot_pkgs_files() : Spot all packages that show-up in R or Rmarkdown or quarto documents in a dataframe of filepaths.

spot_funs_files() : Spot all functions and their corresponding packages that show-up in R or Rmarkdown or quarto documents in a dataframe of filepaths.

Usage

spot_funs_files(df, ..., .progress = TRUE)

spot_pkgs_files(df, ..., .progress = TRUE)

Arguments

df

Dataframe containing a column of absolute_paths.

...

Arguments passed onto spot_{pkgs|funs}().

.progress

Whether to show a progress bar. Use TRUE to a turn on a basic progress bar, use a string to give it a name, or see progress_bars for more details.

Value

Dataframe with relative_paths and absolute_paths of file paths along with a list-column spotted containing purrr::safely() named list of "result" and "error" for each file parsed. Use unnest_results() to unnest only the "result" values.

Details

A purrr::safely() wrapper for mapping spot_pkgs() or spot_funs() across multiple filepaths. I.e. even if some files fail to parse the function will continue on.

Default settings are meant for files where package libraries are referenced within the files themselves. See README for more details.

Examples

# \donttest{
library(funspotr)
library(dplyr)

list_files_github_repo("brshallo/feat-eng-lags-presentation", branch = "main") %>%
  spot_funs_files()
#>  ■■■■■■■■■■■■■■■■                  50% |  ETA:  1s
#> # A tibble: 4 × 3
#>   relative_paths                absolute_paths                      spotted     
#>   <chr>                         <chr>                               <list>      
#> 1 R/Rmd-to-R.R                  https://raw.githubusercontent.com/… <named list>
#> 2 R/feat-engineering-lags.R     https://raw.githubusercontent.com/… <named list>
#> 3 R/load-inspections-save-csv.R https://raw.githubusercontent.com/… <named list>
#> 4 R/types-of-splits.R           https://raw.githubusercontent.com/… <named list>
# }