R Under development (unstable) (2023-12-09 r85665 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library("matrixStats") > > signTabulate0 <- function(x, ...) { + nneg <- sum(x < 0, na.rm = TRUE) + nzero <- sum(x == 0, na.rm = TRUE) + npos <- sum(x > 0, na.rm = TRUE) + nna <- sum(is.na(x)) + nneginf <- sum(is.infinite(x) & x < 0, na.rm = TRUE) + nposinf <- sum(is.infinite(x) & x > 0, na.rm = TRUE) + res <- c(nneg, nzero, npos, nna, nneginf, nposinf) + res <- as.double(res) + names(res) <- c("-1", "0", "+1", "NA", "-Inf", "+Inf") + if (is.integer(x)) res <- res[1:4] + res + } # signTabulate0() > > > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > # Subsetted tests > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > source("utils/validateIndicesFramework.R") > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) > x[2:3, 4:5] <- +Inf > x[4:5, 1:2] <- -Inf > for (idxs in index_cases) { + validateIndicesTestVector(x, idxs, + ftest = signTabulate, fsure = signTabulate0) + } > > proc.time() user system elapsed 0.17 0.03 0.18