Hi,
Take a look at the rle() function. This finds runs of equal values in
vectors. Using apply this can quite easily be run for all the
rows/columns of a matrix.
cheers,
Paul
On 08/30/2011 04:58 PM, Martin Batholdy wrote:
> Hi,
>
> I have the following, rather unorthodox problem:
>
>
> I have a
Hi,
I have the following, rather unorthodox problem:
I have a matrix that looks like this:
m1 <- matrix(c('a','b','d',NA,'c','c'), 2,3, byrow=TRUE)
[,1] [,2] [,3]
[1,] "a" "b" "d"
[2,] NA "c" "c"
now I would like to transform this matrix into this matrix:
[,1] [,2]
2 matches
Mail list logo