> do.call(rbind, L)
       ID stat pvalue
a.1  Herb    4   0.03
a.2 Shrub    5   0.04
b.1  Herb   12   0.20
b.2 Shrub   15   0.40
b.3  Tree   13   0.30


HTH,
Dennis



On Mon, Mar 28, 2011 at 5:01 PM, chipmaney <chipma...@hotmail.com> wrote:

> I have created a list of tables with the same columns but different number
> of
> row.
>
> Example (actual list has ~200 elements):
>
> > temp1<- data.frame(ID=c("Herb","Shrub"),stat=c(4,5),pvalue=c(.03,.04))
> > temp2<- data.frame(ID=c("Herb","Shrub",
> > "Tree"),stat=c(12,15,13),pvalue=c(.2,0.4,.3))
> > L<-list(a=temp1,b=temp2)
>
>
> > L
> $a
>     ID stat pvalue
> 1  Herb    4   0.03
> 2 Shrub    5   0.04
>
> $b
>     ID stat pvalue
> 1  Herb   12    0.2
> 2 Shrub   15    0.4
> 3  Tree   13    0.3
>
>
> I want to use apply() or some other vectorized function to create a
> data.frame that appends/binds all rows from all elements, such that I get:
>
>     ID stat pvalue
> 1  Herb    4   0.03
> 2 Shrub    5   0.04
> 3  Herb   12   0.20
> 4 Shrub   15   0.40
> 5  Tree   13   0.30
>
> I'll forego the question of how to get the list element IDs (i.e., "a",
> "b")
> into the resulting table, unless you have the time....
>
> thank in advance, chipper
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/List-extraction-tp3413374p3413374.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>

        [[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