ast_decompose: Decompose an R function

View source: R/ast_decompose.R

ast_decomposeR Documentation

Decompose an R function

Description

Decompose an R function

Usage

ast_decompose(x)

Arguments

x

a function

Value

result of utils::getParseData(), a data.frame; but we wrap it in a thin S3 wrapper to make it easy to see how the function changes as you modify it with ast_modify()

Examples

foo <- function(x) {
  x + 1
}
foo(5)
df <- ast_decompose(foo)
df
data.frame(df)
attributes(df)
attr(df, "expr")
attr(df, "expr")[1,"text"] # the original fxn

ropenscilabs/astr documentation built on Nov. 13, 2024, 12:16 a.m.