Skip to contents

Extract function calls from character vector of R code

Usage

extract_functions(code)

Arguments

code

Object that contains R code

Value

Returns character vector of function names without parentheses (e.g., it returns "library" rather than "library()") included in R code.

Note

This function is adapted from one Yihui Xie posted at https://yihui.org/en/2023/01/func-call/.

Examples

extract_functions(extract_code(
  "https://raw.githubusercontent.com/JeffreyRStevens/flashr/refs/heads/main/README.Rmd"))
#> [1] "set"              "install.packages" "install_github"   "library"         
#> [5] "flashcard"        "flashcard"        "read.csv"         "head"            
#> [9] "flashcard"