[R] another matrix problem

William Simpson william.a.simpson at gmail.com
Sun Jul 5 14:54:42 CEST 2009


I want a function that takes an input vector, the number of columns
and returns a matrix as follows.

x<- 1:5

foo(x, nc=3)

1 5 4
2 1 5
3 2 1
4 3 2
5 4 3

Thanks again for any help.

Bill




More information about the R-help mailing list