[R] how to apply the same function to multiple data set
Dimitris Rizopoulos
d.rizopoulos at erasmusmc.nl
Wed Jun 27 13:45:43 CEST 2012
you will have to check what function pargev() returns as a result. I
would guess that is probably a list. In any case, you could use
something like the following:
estIID50 <- lapply(IID50, function (m) pargev(lmom.ub(m)))
I hope it helps.
Best,
Dimitris
On 6/27/2012 1:31 PM, Al Ehan wrote:
> Hi R-users,
>
> I'm trying to repeat the same procedure to 1000 data set. I know this is
> very easy, but I got stuck finding the right and fastest way in running it.
>
> IID50=Riidf[1:50,1:1000] #where IID50 is a dataframe consist of 1000 time
> series(as column) and 50 time scales (row).
>
> #what I tried to do:
>
> estIID50=rep(NA,1000)
> for (i in 1:1000)
> estIID50[i]=pargev(lmom.ub(IID50[1:50,i]))
>
> #warning message
> In estIID50[i] = pargev(lmom.ub(IID50[1:50, i])) :
> number of items to replace is not a multiple of replacement length
>
> #pargev is a function from lmomco package. I would like to apply it to the
> 1000 set of time series that I have in the IID50, without having to do it
> manually.
> #I dont understand what is the warning warns about
>
> Can somebody help me?
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center
Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014
Web: http://www.erasmusmc.nl/biostatistiek/
More information about the R-help
mailing list