Hi Jonas,
You could use a construct like this:
out = do.call('rbind', lapply(list, do.stuff))
Or you could use ldply from the plyr package:
out = ldply(list, do.stuff)
I use the plyr package a lot for these kinds of operations. It also
supports a progress bar and parallel computing.
cheers,
Paul
On 05/24/2011 09:16 AM, Jonas Zierer wrote:> Hi everybody,
>
> my problem is the following: I have a function which produces for an
> input number a dataframe with a fixed number of columns and 0 to 10
> rows.
> Now i want to apply this function to a vector with different inputs and
> merge all these result-dataframes in one data.frame.
>
>
> Can i give a data.frame-reference to the function, so that the result of
> the function is not returned but appended to the given data.frame?
>
>
> Or i could use lapply, but then i have to find a way to merge the single
> dataframes in the returned list (the only solution i found for this is a
> for loop over all list entries and merging them...but there must be a
> better solution, or?)
>
> thx. bye
> Jonas
>
> ______________________________________________
> 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.
--
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