Examples for 'lazyeval::function_new'


Create a function by "hand"

Aliases: function_new

Keywords:

### ** Examples

f <- function(x) x + 3
g <- function_new(alist(x = ), quote(x + 3))

# The components of the functions are identical
identical(formals(f), formals(g))
[1] TRUE
identical(body(f), body(g))
[1] TRUE
identical(environment(f), environment(g))
[1] TRUE
# But the functions are not identical because f has src code reference
identical(f, g)
[1] TRUE
attr(f, "srcref") <- NULL
# Now they are:
stopifnot(identical(f, g))

[Package lazyeval version 0.2.2 Index]