[R] Making multiple columns to a single column

Stephan Kolassa Stephan.Kolassa at gmx.de
Sun Mar 14 00:40:27 CET 2010


Hi Hyo,

how about as.vector(ttx1) or as.vector(t(ttx1))?

HTH
Stephan


Hyo Lee schrieb:
> Hi guys,
> 
> I have a very simple question.
> I'm trying to make multiple columns to a single column.
> 
> For example,
> 
> *ttx1* is a 46*72 matrix.
> 
> so, I tried this.
> 
> *d1=ttx1[,1]
> d2=ttx1[,2]
> ...
> d72=ttx1[,72]*
> 
> now, d1, d2, ...,d72 become a 46*1 matrix.
> And then.. I tried..
> 
> *dd=rbind(d1, d2, ..., d72)*
> 
> I thought *dd* should be 3312*1 matrix; but it becomes 72*46.
> I really wanted to make it a  single column (3312*1).
> 
> Do you know what is wrong in this code? Or, do you have a better idea in
> making multiple columns to a single column?
> 
> Thank you so much.
> 
> -Hyo
> 
> 	[[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.
>



More information about the R-help mailing list