Entering edit mode
The colMax() function from the xcms package is very useful and even has good documentation, but why is it not exported?! Are there alternatives to "Find row and column maximum values for numeric arrays"?
library(xcms)
a1 <- array(1:(2*3*5),dim=c(5,3,2))
xcms:::colMax(a1)
[,1] [,2]
[1,] 5 20
[2,] 10 25
[3,] 15 30
colMax(a1)
Error in colMax(a1) : could not find function "colMax"
?colMax
sessionInfo()
R Under development (unstable) (2021-01-28 r79891)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats4 parallel stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] xcms_3.13.8 MSnbase_2.17.7 ProtGenerics_1.23.9
[4] S4Vectors_0.29.9 mzR_2.25.5 Rcpp_1.0.6
[7] Biobase_2.51.0 BiocGenerics_0.37.1 BiocParallel_1.25.5
xcms implemented it in c, which is 50 times faster than
apply()
: