try this:
> M <- matrix(c("1","2","3","2","4","5","5","3","2","1","3","2","4","4"),
> ncol=2)
> M
[,1] [,2]
[1,] "1" "3"
[2,] "2" "2"
[3,] "3" "1"
[4,] "2" "3"
[5,] "4" "2"
[6,] "5" "4"
[7,] "5" "4"
> # not the most efficient
> M.sorted <- apply(M, 1, function(x) paste(sort(x), co
Dear list,
Suppose I have the following matrix:
> M <-
matrix(c("1","2","3","2","4","5","5","3","2","1","3","2","4","4"), ncol=2)
> M
[,1] [,2]
[1,] "1" "3"
[2,] "2" "2"
[3,] "3" "1"
[4,] "2" "3"
[5,] "4" "2"
[6,] "5" "4"
[7,] "5" "4"
In this matrix, row 1 contains elements "1" an
2 matches
Mail list logo