mutate_one: Make a mutation in one function

Description Usage Arguments Value Note Examples

View source: R/mutate.R

Description

Make a mutation in one function

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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

1
2
3
4
5
6
7
8
## Not run: 
foo <- function(x) {
  if (x == 1) x else 5
}
mutate_one(foo)
mutate_one(astr::ast_decompose(foo))

## End(Not run)

ropensci/mutant documentation built on Dec. 30, 2021, 11:53 a.m.