Displaying 1 result from an estimated 1 matches for "row_max".
Did you mean:
iov_max
2010 Apr 18
2
Calculating a Maximum for a row or column with NA's
...ow=3)
> m
[,1] [,2] [,3]
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9
> m[3,1]=NA
> m[1,]=NA
> m
[,1] [,2] [,3]
[1,] NA NA NA
[2,] 2 5 8
[3,] NA 6 9
# applying max to rows doesnt work as max returns
# NA if any of the elements is NA.
> row_max<-apply(m,1,max)
> row_max
[1] NA 8 NA
# my desired result given m would be:
# NA, 8, 9
[[alternative HTML version deleted]]