Hi, embed() seemed well-suited, but I couldn't figure out an elegant way to use it
embed(c(A,A), 4)[1:4, 4:1] HTH, baptiste On 6 January 2011 22:34, ADias <[email protected]> wrote: > > 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. > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

