HenrikBengtsson / matrixStats

R package: Methods that Apply to Rows and Columns of Matrices (and to Vectors)
https://cran.r-project.org/package=matrixStats
203 stars 33 forks source link

Add logical matrix as a legal input to row|colCumsums. #150

Closed bkmontgom closed 5 years ago

bkmontgom commented 5 years ago

Always returns an integer matrix. This is true even for a 0x0 input.

Add logical matrix to tests (except for 0x0).

See #139

codecov-io commented 5 years ago

Codecov Report

Merging #150 into develop will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #150      +/-   ##
===========================================
+ Coverage     89.6%   89.61%   +<.01%     
===========================================
  Files          109      109              
  Lines         4137     4139       +2     
===========================================
+ Hits          3707     3709       +2     
  Misses         430      430
Impacted Files Coverage Δ
R/rowCumsums.R 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8bd3438...4f82c01. Read the comment docs.

HenrikBengtsson commented 5 years ago

Thanks for this patch. However, I went with a solution that avoids the logical-to-integer coercion; since logical are represented as 0-1 integers internally in R, it didn't take much to adjust the native code to accept logicals too (https://github.com/HenrikBengtsson/matrixStats/commit/ceb6a0f4647dcedfae39650d01e050c50b3eecd4)