Re: [R] R: extract data.frames from a list

2009-07-17 Thread baptiste auguie
try this,

do.call(rbind, tmp)

baptiste

2009/7/17 Angel Spassov anspas...@googlemail.com

 Dear useRs and developeRs,

 I am struggling with a simple but not obviously solvable issue. Suppose I
 have the following list of data.frames called 'tmp':

 a - data.frame(a=rnorm(10),b=letters[1:10])
 (tmp - list(a,a[1:4,],a[1:7,]))

 It is known that all data.frames in this list have the same number of
 columns (and this is a good thing). I want to build a bigger data.frame
 consisting of all list-members, e.g. the result should look like:

 (res - rbind(tmp[[1]],tmp[[2]],tmp[[3]]))

 The question is how could I do this most efficiently? My real list consist
 of about 700 data.frames, each with with exactly 10 columns and plenty of
 rows. The obvious for-loop solution is rather time consuming and therefore
 I'm looking for something more efficient.

 Thank you in advance,
 AS.

 ps: 'sapply' should somehow do the trick, doesn't it?

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




-- 

_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag
__

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


Re: [R] R: extract data.frames from a list

2009-07-17 Thread Henrique Dallazuanna
do.call(rbind, tmp)

On Fri, Jul 17, 2009 at 10:55 AM, Angel Spassov anspas...@googlemail.comwrote:

 Dear useRs and developeRs,

 I am struggling with a simple but not obviously solvable issue. Suppose I
 have the following list of data.frames called 'tmp':

 a - data.frame(a=rnorm(10),b=letters[1:10])
 (tmp - list(a,a[1:4,],a[1:7,]))

 It is known that all data.frames in this list have the same number of
 columns (and this is a good thing). I want to build a bigger data.frame
 consisting of all list-members, e.g. the result should look like:

 (res - rbind(tmp[[1]],tmp[[2]],tmp[[3]]))

 The question is how could I do this most efficiently? My real list consist
 of about 700 data.frames, each with with exactly 10 columns and plenty of
 rows. The obvious for-loop solution is rather time consuming and therefore
 I'm looking for something more efficient.

 Thank you in advance,
 AS.

 ps: 'sapply' should somehow do the trick, doesn't it?

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




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

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


Re: [R] R: extract data.frames from a list

2009-07-17 Thread Angel Spassov
Right on target! Very appreciated. Thanks.

Cheers,
AS

On Fri, Jul 17, 2009 at 4:39 PM, Henrique Dallazuanna www...@gmail.comwrote:

 do.call(rbind, tmp)

 On Fri, Jul 17, 2009 at 10:55 AM, Angel Spassov 
 anspas...@googlemail.comwrote:

 Dear useRs and developeRs,

 I am struggling with a simple but not obviously solvable issue. Suppose I
 have the following list of data.frames called 'tmp':

 a - data.frame(a=rnorm(10),b=letters[1:10])
 (tmp - list(a,a[1:4,],a[1:7,]))

 It is known that all data.frames in this list have the same number of
 columns (and this is a good thing). I want to build a bigger data.frame
 consisting of all list-members, e.g. the result should look like:

 (res - rbind(tmp[[1]],tmp[[2]],tmp[[3]]))

 The question is how could I do this most efficiently? My real list consist
 of about 700 data.frames, each with with exactly 10 columns and plenty of
 rows. The obvious for-loop solution is rather time consuming and therefore
 I'm looking for something more efficient.

 Thank you in advance,
 AS.

 ps: 'sapply' should somehow do the trick, doesn't it?

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




 --
 Henrique Dallazuanna
 Curitiba-Paraná-Brasil
 25° 25' 40 S 49° 16' 22 O


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