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

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu 02 Feb 2006 - 19:00:54 EST

Try this:

rbind(c(x))
cbind(c(x))

t(c(x))

On 2/2/06, Michael <comtech.usa@gmail.com> wrote:
> Hi all,
>
> I tended to use rbind, or cbind to force a vector be be deemed as a column
> or row vector. This is very important if I want to do things like u' * A *
> u, where u' is a row vector and u is a column vector, regardless of what
> originall format the "u" is... I want to recast it to column vector or row
> vector... How can I do that?
>
> ----------------------------------------------------
>
>
> b_hat=solve(t(X) %*% X) %*% t(X) %*% Y;
>
> attr(b_hat, "dim")
> [1] 4 1
>
> rbind(b_hat)
> [,1]
> -4.814763
> V -5.804245
> -5.122668
> -4.308326
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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
>



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 Thu Feb 02 19:08:55 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Feb 2006 - 02:21:36 EST