For me, this example runs in a fraction of a second:
> t1 <- data.frame(matrix(rnorm(3e6),ncol=3))
> t2 <- data.frame(matrix(rnorm(3e6),ncol=3))
> t3 <- cbind(t1,t2)
> dim(t3)
[1] 1000000 6
Maybe it takes longer if your data frames have other classes of objects in
them.
If some of your data frame columns are factors, try converting to
character first.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 1/6/12 9:56 AM, "Mary Kindall" <mary.kindall at gmail.com>
wrote:
>>
>> I have two dataframes and want to perform cbind and then write into a
>> file. The number of entries are more than a million in both frames. R
is
>> taking a lot of time performing this operation.
>>
>> Is there any alternate way to perform cbind?
>>
>> x = table1[1:1000000,1:4]
>> y = table2[1:1000000,3:6]
>>
>> z = cbind(x,y) //hanging the machine
>>
>> write.table(z,'out.txt)
>>
>>
>>
>> --
>> -------------
>> Mary Kindall
>> Yorktown Heights, NY
>> USA
>>
>>
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at 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.