s-news
[Top] [All Lists]

Re: concatenation of dataframes

To: JedSimons@aol.com
Subject: Re: concatenation of dataframes
From: Spencer Graves <spencer.graves@PDF.COM>
Date: Thu, 08 May 2003 12:39:58 -0700
Cc: s-news@lists.biostat.wustl.edu
References: <13.1c619328.2bebff9c@aol.com>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02
Have you tried first creating a data.frame of the ultimate size and then assigning the pieces of it in a for loop?

hope this helps.  spencer graves

JedSimons@aol.com wrote:
I have a large number of dataframes, themselves each quite large. I would like to rbind them all together in an efficient way, but have failed to do so using several methods. They are all of the same form, and collected together in a list.
The best I've come up is to concatenate each column one at at time eg

y <- as.vector(unlist(sapply(data.list, function(x) x$y)))

where y is the column ID
and data.list is the list of dataframes

and then cbind them all together.

I have tried using a nested lapply to unlist all the columns in one swift function but have been unable to make this work. The other alternative would to extract each dataframe as data.list[[1]], data.list[[2]] and then rbind them all together, but it seems even less good.

Can anyone suggest a better way of doing this ?

Many thanks
Jed Simmons



<Prev in Thread] Current Thread [Next in Thread>