dry_run: dry_run

Description Usage Arguments Value Examples

View source: R/dry_run.R

Description

Like the identity function but reports on changes in values caused by the application of the function.

Usage

1
dry_run(x, fun, type = c("all"))

Arguments

x

object

fun

function

Value

x reporting with a message about changes to those values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  c(-2:2) %>% dry_run( sqrt ) 
  c(-2:2) %>% dry_run( sqrt, "all" )
  c(-2:2) %>% dry_run( sqrt, "changed" )
  c(-2:2) %>% dry_run( sqrt, "unchanged" )   


  data(iris)
  setDT(iris)
  iris[ , Species := Species %>% dry_run( toupper ) ] 
  
  iris$Species # unchanged
  

decisionpatterns/coercion documentation built on Nov. 4, 2019, 10:23 a.m.