[R] Trying to build up functions with its names by means of lapply

Julio Sergio juliosergio at gmail.com
Thu Jun 6 17:28:36 CEST 2013


Bert Gunter <gunter.berton <at> gene.com> writes:

> Another equivalent way to do it?
> 
> f2 <- function(c,nm = "gamma",...)
> {
>   probFunc <- paste0(c,nm)
>   more <- list(...)
>   function(x)do.call(probFunc,c(x,more))
> }
> 
> This avoids the explicit use of get() and force(), I believe, but are
> there problems here I'm missing?
> 

Thanks Bert. Since I'm relatively new in using this language, a question 
arises in my mind: why should the use of get() and force() be avoided? Is it 
just for syntactic clarity or is there another computational reason?

Best regards,

  -Sergio.



More information about the R-help mailing list