Re: [R] Simple way to define a function to be used in a formula object inside another function

2013-12-15 Thread Frank Harrell
Thank you Bill, that worked perfectly. Frank __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, r

Re: [R] Simple way to define a function to be used in a formula object inside another function

2013-12-15 Thread William Dunlap
rg [mailto:r-help-boun...@r-project.org] On > Behalf > Of Frank Harrell > Sent: Sunday, December 15, 2013 10:09 AM > To: RHELP > Subject: [R] Simple way to define a function to be used in a formula object > inside another > function > > I would like to do this: >

[R] Simple way to define a function to be used in a formula object inside another function

2013-12-15 Thread Frank Harrell
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?