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

> 
> faux <- function(c, nm = "gamma",...){
>      f <- get(paste0(c,nm))
>       function(x)f(x,...)
>     }
> 
> This could be called with:
> 
> > xgam <- lapply(c("p","d"), faux, shape=k, scale=theta)
> > xgam[[1]](1000)
> [1] 0.8710477
> > xgam[[2]](1000)
> [1] 0.001265311
> 

Excellent, Bert, and thanks a lot for your contribution! In fact, I was 
planning to write a separate functions producer for each distribution. This 
really saves me a lot of work!


  -Sergio

______________________________________________
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, reproducible code.

Reply via email to