mutate_one: Make a mutation in one function

View source: R/mutate.R

mutate_oneR Documentation

Make a mutation in one function

Description

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

## 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 Nov. 13, 2024, 8:31 a.m.