HenrikBengtsson/matrixStats

Support for logical input in rowCummaxs et al.?

Closed this issue · 1 comments

First, thanks a lot for an excellent package.

This issue is related to colCumprods() does not support logical input, which was implemented. I just noted some other functions which don't support logical input: rowCummaxs, rowCummins, colCummaxs, colCummins. It would be great if they also could handle a logical x.

m = matrix(c(TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE), nrow = 3, byrow = TRUE)
m
#       [,1]  [,2]  [,3]
# [1,]  TRUE FALSE FALSE
# [2,] FALSE  TRUE FALSE
# [3,] FALSE FALSE  TRUE

rowCummaxs(m)
# Error in rowCummaxs(m) : Argument 'x' cannot be logical.

rowCummins(m)
# Error in rowCummins(m) : Argument 'x' cannot be logical.

colCummaxs(m)
# Error in colCummaxs(m) : Argument 'x' cannot be logical.

colCummins(m)
# Error in colCummins(m) : Argument 'x' cannot be logical.

I've just added support for this in the develop branch.