Displaying 2 results from an estimated 2 matches for "isnotna".
Did you mean:
isnot
2009 Nov 21
1
how to ignore NA when using cumsum WHILE retaining NAs?
I would like to cumulatively sum rows in a matrix, in which each row has 1
NA value, which I do NOT want to treat as 0s. The NAs are placeholders
where there is actually no data, which is not the same as a 0. The usual
"na.rm=TRUE" does not seem to work with the command cumsum. Is there
another way to ignore the NAs or do I need to figure out a different way to
do this?
Here's an
2009 Nov 21
7
consecutive numbering of elements in a matrix
Within a very large matrix composed of a mix of values and NAs, e.g, matrix A:
[,1] [,2] [,3]
[1,] 1 NA NA
[2,] 3 NA NA
[3,] 3 10 17
[4,] 4 12 18
[5,] 6 16 19
[6,] 6 22 20
[7,] 5 11 NA
I need to be able to consecutively number, in new columns, the non-NA
values within each column (i.e. A[1,1] A[3,2] and A[3,3] would all be set
to one, and