spot_funs {funspotr}R Documentation

Spot Functions

Description

Given file_path extract all functions and their associated packages from specified file.

Usage

spot_funs(file_path, ...)

Arguments

file_path

character vector of path to file.

...

This allows you to pass additional arguments through to spot_funs_custom().

Details

spot_funs() uses spot_funs_custom() to run – it is a less verbose version and does not require passing in the packages separately. See README and ?spot_funs_custom for details on how the function works and arguments that can be passed through (via ...).

If code syntax is malformed and cannot be properly parsed, function will error.

Value

Given default arguments and no missing packages, a dataframe with the following columns is returned:

funs: specifying functions in file. pkgs: the package a function came from. If funs is a custom function or if it came from a package not installed on your machine, pkgs will return "(unknown)".

Note that any unused loaded packages / pkgs are dropped from output. Any functions without an available package are returned with the value "(unknown)".

See README for further documentation.

See Also

spot_funs_custom(), spot_funs_files()

Examples

library(funspotr)

file_lines <- "
library(dplyr)
require(tidyr)
library(madeUpPkg)

as_tibble(mpg) %>%
  group_by(class) %>%
  nest() %>%
  mutate(stats = purrr::map(data,
                            ~lm(cty ~ hwy, data = .x)))

made_up_fun()
"

file_output <- tempfile(fileext = ".R")
writeLines(file_lines, file_output)

spot_funs(file_output)

[Package funspotr version 0.0.4 Index]