Skip to content
Prev 15237 / 63421 Next

matrix operations

On Sun, 20 Feb 2005, Melanie Vida wrote:

            
I am assuming this is a numeric matrix, and "inf" means Inf and in places 
that there are no NAs.
Not really, but is.infinite will do a C-level iteration, as will ==

dataM[rowSums(is.infinite(dataM)) > 0, ] # rows containing Inf or -Inf
dataM[rowSums(dataM == Inf), ]           # rows containing Inf  (no NAs)
A <- !is.na(dataM) & dataM == Inf
dataM[rowSums(A), ]                      # rows containing Inf (possible NAs)
How about

for(i in 1:4) dataM[, i] <- sort(dataM[, i], method ="quick")

?