Displaying 1 result from an estimated 1 matches for "copyfunction".
Did you mean:
conefunction
2008 Sep 09
2
make methods work in lapply - remove lapply's environment
...the formals, the body, and the
> environment. You can't remove any part, but you can change it.
That is exactly what I want to do, remove the environment, so that
when I define a better version of some function that the better
version is used.
Here's a function to automate the process:
copyFunction <- function(Name){
# Copy a function, without its environment.
# Name should be quoted
# Return the copy
file <- tempfile()
on.exit(unlink(file))
dput(get(Name), file = file)
f <- source(file)$value
f
}
lapply <- copyFunction("lapply")
[[alternative HTML vers...