1) Is the t() function to transpose a matrix. A vector it-self has no 
dimension (I believe). Here is an example:

> vv <- c(1,2,3)
> vv
[1] 1 2 3
> matrix(vv)
     [,1]
[1,]    1
[2,]    2
[3,]    3
> t(matrix(vv))
     [,1] [,2] [,3]
[1,]    1    2    3



2) To create a matrix from two vectors use the cbind() or rbind() to 
combine the vectors in a column or row-wise manner:

> aa <- c(1,2,3)
> bb <- c(4,5,6)
> rbind(aa,bb)
   [,1] [,2] [,3]
aa    1    2    3
bb    4    5    6
> cbind(aa,bb)
     aa bb
[1,]  1  4
[2,]  2  5
[3,]  3  6
> 




Eli Duenisch <duenisch@stud.uni-frankfurt.de> 
Sent by: r-sig-finance-bounces@stat.math.ethz.ch
07/04/2008 07:28 AM

To
r-sig-finance@stat.math.ethz.ch
cc

Subject
[R-SIG-Finance] convert row-vector to column-vector/compose matrix from 
two vectors





Hi,
i'm just a newbie and there are two problems i couldn't google:
1.) How to convert a row-vector to a column-vector (and vice versa)?
2.)How to compose a matrix from two vectors (that have the same length)?
Thank you for your patience and best regards,
Eli D.

_______________________________________________
R-SIG-Finance@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.


	[[alternative HTML version deleted]]

