duplicate: Duplicate a function. Returns a carbon copy of the original,...

Description Usage Examples

View source: R/utils.R

Description

Duplicate a function. Returns a carbon copy of the original, so that original can be modified safely.

Usage

1

Examples

1
2
3
4
5
6
7
8
## Not run: 
   fn <- function(x) cat(x, "\n")
   fn2 <- duplicate(fn)
   fn <- function(x) cat(x, "woof","\n")
   fn("hello") # hellowoof
   fn2("hello") # hello

## End(Not run)

robertzk/vc.r documentation built on May 27, 2019, 11:38 a.m.