[R] What is the fastest way to combine all columns of a matrix to one column?

Petr PIKAL petr.pikal at precheza.cz
Mon Feb 27 11:54:58 CET 2012


Hi
> Hi,
> 
> Thank you. I actually wanted to reserve the rows, I dont know how to
> do this with
> dim(mm) <-NULL

I do not understand. What does it mean reserve rows. Matrix is a vector 
with dimension so you can change dimensions freely with 

dim(mm) <- any suitable combination

dim(mm) <-NULL

gives you plain vector

dim(mm) <- c(rows, columns)

gives you now matrix with specified number of rows and columns. You can 
put columns to 1 and in that case you will get one column matrix.

Please provide some toy example what do you really want.

Regards
Petr


> 
> thanks again
> 
> 
> On 2/27/12, Petr PIKAL <petr.pikal at precheza.cz> wrote:
> > Hi
> >>
> >> Dear all,
> >>
> >> Newbie: What is the fastest way to combine all columns of a matrix to
> > one
> >> column?
> >
> > If mm is your matrix use
> >
> > dim(mm) <-NULL
> >
> > Regards
> > Petr
> >
> >
> >>
> >> --
> >> View this message in context: 
http://r.789695.n4.nabble.com/What-is-the-
> >>
> > fastest-way-to-combine-all-columns-of-a-matrix-to-one-column-
> tp4423882p4423882.html
> >> Sent from the R help mailing list archive at Nabble.com.
> >>
> >> ______________________________________________
> >> 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