[R] Creating a Matrix from a vector with some conditions

ADias diasandre at gmail.com
Thu Jan 6 22:34:31 CET 2011


Hi

Suppose we have an object with strings:

A<-c("a","b","c","d")

Now I do:

B<-matrix(A,4,4, byrow=F)

and I get

a a a a
b b b b
c c c c
d d d d

But what I really want is:

a b c d
b c d a
c d a b
d a b c

How can I do this?

thank you

A. Dias
-- 
View this message in context: http://r.789695.n4.nabble.com/Creating-a-Matrix-from-a-vector-with-some-conditions-tp3178219p3178219.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list