Re: [R] How to force a vector to be column or row vector?

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Fri 03 Feb 2006 - 01:43:10 EST

On 2/2/06, Liaw, Andy <andy_liaw@merck.com> wrote:
> From: Gabor Grothendieck
> >
> > Try this:
> >
> >
> > rbind(c(x))
> > cbind(c(x))
> > t(c(x))
>
> The c() is not needed above.

The poster asked for an expression that would work "regardless of the original form" of the vector -- row, column or neither. The c gets it into a known form first. For example:

> cbind(matrix(1,1,3)) # not a column vector!

     [,1] [,2] [,3]
[1,] 1 1 1



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Feb 03 01:55:52 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Feb 2006 - 14:38:05 EST