[R] Simple way to define a function to be used in a formula object inside another function
Frank Harrell
f.harrell at Vanderbilt.Edu
Sun Dec 15 19:08:46 CET 2013
I would like to do this:
f <- function(formula, data=NULL) {
gg <- sqrt
model.frame(formula, data=data)
}
x <- y <- 1:10
f(y ~ gg(x))
Error in eval(expr, envir, enclos) : could not find function "gg"
Is there a simple way to get access to gg from within the model.frame
invocation inside f?
Thanks
Frank
More information about the R-help
mailing list