[R] extract column's from different dataframe

Jim Lemon jim at bitwrit.com.au
Thu Oct 17 12:55:19 CEST 2013


On 10/17/2013 06:17 PM, catalin roibu wrote:
> Dear R users,
>
> I want to extract column's from different data frame with different row
> length.
> How can I do this in R?
>
Hi catalin,
If I understand your question, which I think is:

I want to extract columns from different data frames with differing 
numbers of rows and store them in a single object.

The answer is probably to use a list:

datalist<-list()
datalist[[1]]<-dataframe1[,"variable1"]
datalist[[2]]<-dataframe2[,"variable3"]
...

where each element of "datalist" may have different numbers of values.

Jim



More information about the R-help mailing list