[R] writing function:loop and rbind

arnaud Gaboury arnaud.gaboury at gmail.com
Mon May 24 14:54:37 CEST 2010


Dear group,

I have a function, let's call it myfun, wich give me a list of result:
R1,R2,R3...
There is a loop in this function to get my results. Here is the structure of
my function:

Myfun<-function()

{
For (i in X ){

-----------instructions---------

Ri

{
{

All Results (R1,R2...) are Data.frame. As a final result (call it "Final"),
I need to rbind all these dataframe. One solution could be to create another
loop, but I think I can avoid it. How can I add a line like this :
Final<-rbind(R1,R2...) using the i parameter? Another solution could may be
to create a list of all my results, then apply rbind to the list?

Any idea would be appreciated.

TY in advance



More information about the R-help mailing list