Hello Paul
I have also tried this one
distrList<-c("norm","lnorm","pois","exp","gamma","nbinom","geom","logis"); 
    return (lapply(distrList, function(distrList) { fitdist(x1,distrList)}));

which seems to work.
I am not sure though if there is a strict performance penalty.

B.R
Alex



________________________________
From: Paul Hiemstra <paul.hiems...@knmi.nl>

Cc: "R-help@r-project.org" <R-help@r-project.org>
Sent: Thursday, October 6, 2011 10:07 AM
Subject: Re: [R] apply and functions with many arguments


On 10/06/2011 08:03 AM, Alaios wrote: 
Dear all,
I would like to use the following function fitdist(data, distr, method=c("mle", 
"mme", "qme", "mge"),
start=NULL, fix.arg=NULL, ...) for many different distr values like 
distr=c("norm","lnorm","pois") (just a small example)
and take back into a list the parameter name which is what is inside distr plus 
what the function fitdist returns (another list). How can I do that ?   B.R
Alex [[alternative HTML version deleted]] 
>
______________________________________________ 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. 
Hi,

Take a look at 'expand.grid' and 'ddply' from the plyr package or
    foreach from the foreach package.

cheers,
Paul


-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
        [[alternative HTML version deleted]]

______________________________________________
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