Skip to content
Prev 246654 / 398502 Next

Creating a Matrix from a vector with some conditions

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