Skip to contents

Make a mutation in one function

Usage

mutate_one(x)

# Default S3 method
mutate_one(x)

# S3 method for class '`function`'
mutate_one(x)

# S3 method for class 'ast'
mutate_one(x)

Arguments

x

a data.frame, the output of utils::getParseData(), called from parse_fxns()

Value

the same data.frame as in x, but with a single mutation

Note

uses astr::ast_modify() internally

Examples

if (FALSE) { # \dontrun{
foo <- function(x) {
  if (x == 1) x else 5
}
mutate_one(foo)
mutate_one(astr::ast_decompose(foo))
} # }