colRowAnyMissings - HenrikBengtsson/matrixStats GitHub Wiki
matrixStats: Benchmark report
This report benchmark the performance of colAnyMissings() and rowAnyMissings() against alternative methods.
- colAnyMissings() and rowAnyMissings()
- apply() + anyMissing()
- colSums() + is.na() and rowSums() + is.na()
where
> colAnyMissings <- function(x, ...) colAnys(x, value = NA)and
> rowAnyMissings <- function(x, ...) rowAnys(x, value = NA)> rmatrix <- function(nrow, ncol, mode = c("logical", "double", "integer", "index"), range = c(-100, 
+     +100), na_prob = 0) {
+     mode <- match.arg(mode)
+     n <- nrow * ncol
+     if (mode == "logical") {
+         x <- sample(c(FALSE, TRUE), size = n, replace = TRUE)
+     }     else if (mode == "index") {
+         x <- seq_len(n)
+         mode <- "integer"
+     }     else {
+         x <- runif(n, min = range[1], max = range[2])
+     }
+     storage.mode(x) <- mode
+     if (na_prob > 0) 
+         x[sample(n, size = na_prob * n)] <- NA
+     dim(x) <- c(nrow, ncol)
+     x
+ }
> rmatrices <- function(scale = 10, seed = 1, ...) {
+     set.seed(seed)
+     data <- list()
+     data[[1]] <- rmatrix(nrow = scale * 1, ncol = scale * 1, ...)
+     data[[2]] <- rmatrix(nrow = scale * 10, ncol = scale * 10, ...)
+     data[[3]] <- rmatrix(nrow = scale * 100, ncol = scale * 1, ...)
+     data[[4]] <- t(data[[3]])
+     data[[5]] <- rmatrix(nrow = scale * 10, ncol = scale * 100, ...)
+     data[[6]] <- t(data[[5]])
+     names(data) <- sapply(data, FUN = function(x) paste(dim(x), collapse = "x"))
+     data
+ }
> data <- rmatrices(mode = mode)> X <- data[["10x10"]]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3070635 164.0    5709258 305.0  5709258 305.0
Vcells 5584481  42.7   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings = colAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 2L, 
+     FUN = anyMissing), colSums = is.na(colSums(X, na.rm = FALSE)), unit = "ms")
> X <- t(X)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3069549 164.0    5709258 305.0  5709258 305.0
Vcells 5581643  42.6   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings = rowAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 1L, 
+     FUN = anyMissing), rowSums = is.na(rowSums(X, na.rm = FALSE)), unit = "ms")Table: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on integer+10x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 0.001718 | 0.0020040 | 0.0025483 | 0.0024800 | 0.0026575 | 0.019309 | 
| 3 | colSums | 0.003164 | 0.0035820 | 0.0045810 | 0.0039990 | 0.0046480 | 0.049358 | 
| 2 | apply+anyMissing | 0.022496 | 0.0232115 | 0.0243481 | 0.0236175 | 0.0239760 | 0.077427 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | colSums | 1.841676 | 1.787425 | 1.797690 | 1.612500 | 1.749012 | 2.556217 | 
| 2 | apply+anyMissing | 13.094296 | 11.582585 | 9.554741 | 9.523186 | 9.022013 | 4.009892 | 
Table: Benchmarking of rowAnyMissings(), apply+anyMissing() and rowSums() on integer+10x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 0.001647 | 0.0019670 | 0.0024760 | 0.0023825 | 0.0026000 | 0.018659 | 
| 3 | rowSums | 0.003730 | 0.0040785 | 0.0049448 | 0.0044770 | 0.0049445 | 0.043257 | 
| 2 | apply+anyMissing | 0.022250 | 0.0229470 | 0.0239494 | 0.0232480 | 0.0235625 | 0.078709 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | rowSums | 2.264724 | 2.073462 | 1.997145 | 1.879119 | 1.901731 | 2.318291 | 
| 2 | apply+anyMissing | 13.509411 | 11.665989 | 9.672757 | 9.757817 | 9.062500 | 4.218286 | 
Figure: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on integer+10x10 data as well as rowAnyMissings(), apply+anyMissing() and rowSums() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

 Table: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+10x10 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
Table: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+10x10 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 2 | rowAnyMissings | 1.647 | 1.967 | 2.47596 | 2.3825 | 2.6000 | 18.659 | 
| 1 | colAnyMissings | 1.718 | 2.004 | 2.54827 | 2.4800 | 2.6575 | 19.309 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 2 | rowAnyMissings | 1.000000 | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 1 | colAnyMissings | 1.043109 | 1.01881 | 1.029205 | 1.040923 | 1.022115 | 1.034836 | 
Figure: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+10x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

> X <- data[["100x100"]]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3068101 163.9    5709258 305.0  5709258 305.0
Vcells 5198280  39.7   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings = colAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 2L, 
+     FUN = anyMissing), colSums = is.na(colSums(X, na.rm = FALSE)), unit = "ms")
> X <- t(X)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3068095 163.9    5709258 305.0  5709258 305.0
Vcells 5203323  39.7   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings = rowAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 1L, 
+     FUN = anyMissing), rowSums = is.na(rowSums(X, na.rm = FALSE)), unit = "ms")Table: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on integer+100x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 0.005658 | 0.0061945 | 0.0066545 | 0.0065850 | 0.0068605 | 0.016830 | 
| 3 | colSums | 0.011000 | 0.0115230 | 0.0125151 | 0.0124345 | 0.0129090 | 0.028033 | 
| 2 | apply+anyMissing | 0.165038 | 0.1664370 | 0.1721996 | 0.1675205 | 0.1702105 | 0.307964 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | colSums | 1.94415 | 1.860199 | 1.880706 | 1.888307 | 1.881641 | 1.665657 | 
| 2 | apply+anyMissing | 29.16896 | 26.868512 | 25.877280 | 25.439712 | 24.810218 | 18.298515 | 
Table: Benchmarking of rowAnyMissings(), apply+anyMissing() and rowSums() on integer+100x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 0.007974 | 0.0084310 | 0.0090807 | 0.008863 | 0.009280 | 0.019760 | 
| 3 | rowSums | 0.040060 | 0.0405430 | 0.0414272 | 0.041348 | 0.041754 | 0.050165 | 
| 2 | apply+anyMissing | 0.165285 | 0.1666975 | 0.1733659 | 0.167829 | 0.172191 | 0.309644 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | rowSums | 5.023827 | 4.808801 | 4.562119 | 4.665237 | 4.499353 | 2.538715 | 
| 2 | apply+anyMissing | 20.727991 | 19.771973 | 19.091691 | 18.935913 | 18.555065 | 15.670243 | 
Figure: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on integer+100x100 data as well as rowAnyMissings(), apply+anyMissing() and rowSums() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

 Table: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+100x100 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
Table: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+100x100 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 5.658 | 6.1945 | 6.65447 | 6.585 | 6.8605 | 16.83 | 
| 2 | rowAnyMissings | 7.974 | 8.4310 | 9.08070 | 8.863 | 9.2800 | 19.76 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 2 | rowAnyMissings | 1.409332 | 1.361046 | 1.364602 | 1.345938 | 1.352671 | 1.174094 | 
Figure: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+100x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

> X <- data[["1000x10"]]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3068859 163.9    5709258 305.0  5709258 305.0
Vcells 5202064  39.7   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings = colAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 2L, 
+     FUN = anyMissing), colSums = is.na(colSums(X, na.rm = FALSE)), unit = "ms")
> X <- t(X)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3068850 163.9    5709258 305.0  5709258 305.0
Vcells 5207102  39.8   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings = rowAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 1L, 
+     FUN = anyMissing), rowSums = is.na(rowSums(X, na.rm = FALSE)), unit = "ms")Table: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on integer+1000x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 0.004528 | 0.0049910 | 0.0054688 | 0.0054495 | 0.0056605 | 0.015334 | 
| 3 | colSums | 0.011033 | 0.0115325 | 0.0123142 | 0.0123355 | 0.0127040 | 0.024995 | 
| 2 | apply+anyMissing | 0.070639 | 0.0747955 | 0.0767843 | 0.0753150 | 0.0762035 | 0.175063 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | colSums | 2.436617 | 2.310659 | 2.251727 | 2.263602 | 2.244325 | 1.630038 | 
| 2 | apply+anyMissing | 15.600486 | 14.986075 | 14.040462 | 13.820534 | 13.462327 | 11.416656 | 
Table: Benchmarking of rowAnyMissings(), apply+anyMissing() and rowSums() on integer+1000x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 0.007779 | 0.0081110 | 0.0088606 | 0.008565 | 0.0088575 | 0.041227 | 
| 2 | apply+anyMissing | 0.071069 | 0.0748305 | 0.0766471 | 0.075590 | 0.0765005 | 0.137070 | 
| 3 | rowSums | 0.137214 | 0.1378560 | 0.1386933 | 0.138336 | 0.1387145 | 0.159324 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 2 | apply+anyMissing | 9.136007 | 9.225805 | 8.650354 | 8.825452 | 8.636805 | 3.324763 | 
| 3 | rowSums | 17.639028 | 16.996178 | 15.652861 | 16.151314 | 15.660683 | 3.864555 | 
Figure: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on integer+1000x10 data as well as rowAnyMissings(), apply+anyMissing() and rowSums() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

 Table: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+1000x10 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
Table: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+1000x10 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 4.528 | 4.991 | 5.46879 | 5.4495 | 5.6605 | 15.334 | 
| 2 | rowAnyMissings | 7.779 | 8.111 | 8.86057 | 8.5650 | 8.8575 | 41.227 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 2 | rowAnyMissings | 1.717977 | 1.625125 | 1.620207 | 1.571704 | 1.564791 | 2.688601 | 
Figure: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+1000x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

> X <- data[["10x1000"]]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3069061 164.0    5709258 305.0  5709258 305.0
Vcells 5202854  39.7   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings = colAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 2L, 
+     FUN = anyMissing), colSums = is.na(colSums(X, na.rm = FALSE)), unit = "ms")
> X <- t(X)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3069055 164.0    5709258 305.0  5709258 305.0
Vcells 5207897  39.8   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings = rowAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 1L, 
+     FUN = anyMissing), rowSums = is.na(rowSums(X, na.rm = FALSE)), unit = "ms")Table: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on integer+10x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 0.008065 | 0.0088440 | 0.0097604 | 0.0095400 | 0.0102780 | 0.017663 | 
| 3 | colSums | 0.011586 | 0.0127905 | 0.0142201 | 0.0138025 | 0.0150635 | 0.029127 | 
| 2 | apply+anyMissing | 1.022693 | 1.1110770 | 1.1551814 | 1.1500245 | 1.2128560 | 1.379744 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 | 
| 3 | colSums | 1.436578 | 1.446235 | 1.456925 | 1.446803 | 1.465606 | 1.64904 | 
| 2 | apply+anyMissing | 126.806324 | 125.630597 | 118.354258 | 120.547641 | 118.005059 | 78.11493 | 
Table: Benchmarking of rowAnyMissings(), apply+anyMissing() and rowSums() on integer+10x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 0.008756 | 0.0096875 | 0.0104656 | 0.0104145 | 0.011002 | 0.018797 | 
| 3 | rowSums | 0.032151 | 0.0337365 | 0.0354815 | 0.0347135 | 0.035997 | 0.080521 | 
| 2 | apply+anyMissing | 1.026136 | 1.0952340 | 1.1482911 | 1.1374905 | 1.206508 | 1.341381 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 | 1.000000 | 
| 3 | rowSums | 3.671882 | 3.482477 | 3.390315 | 3.333189 | 3.27186 | 4.283715 | 
| 2 | apply+anyMissing | 117.192325 | 113.056413 | 109.720938 | 109.221806 | 109.66256 | 71.361441 | 
Figure: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on integer+10x1000 data as well as rowAnyMissings(), apply+anyMissing() and rowSums() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

 Table: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+10x1000 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
Table: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+10x1000 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 8.065 | 8.8440 | 9.76037 | 9.5400 | 10.278 | 17.663 | 
| 2 | rowAnyMissings | 8.756 | 9.6875 | 10.46556 | 10.4145 | 11.002 | 18.797 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 
| 2 | rowAnyMissings | 1.085679 | 1.095375 | 1.07225 | 1.091667 | 1.070442 | 1.064202 | 
Figure: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+10x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

> X <- data[["100x1000"]]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3069274 164.0    5709258 305.0  5709258 305.0
Vcells 5203438  39.7   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings = colAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 2L, 
+     FUN = anyMissing), colSums = is.na(colSums(X, na.rm = FALSE)), unit = "ms")
> X <- t(X)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3069268 164.0    5709258 305.0  5709258 305.0
Vcells 5253481  40.1   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings = rowAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 1L, 
+     FUN = anyMissing), rowSums = is.na(rowSums(X, na.rm = FALSE)), unit = "ms")Table: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on integer+100x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 0.038997 | 0.0409690 | 0.0438670 | 0.041997 | 0.0439250 | 0.085250 | 
| 3 | colSums | 0.077633 | 0.0821635 | 0.0845942 | 0.084590 | 0.0862585 | 0.100376 | 
| 2 | apply+anyMissing | 1.505619 | 1.5885610 | 1.6492087 | 1.647717 | 1.7056425 | 1.957127 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | colSums | 1.990743 | 2.005504 | 1.928423 | 2.014191 | 1.963768 | 1.177431 | 
| 2 | apply+anyMissing | 38.608585 | 38.774708 | 37.595641 | 39.234148 | 38.830791 | 22.957501 | 
Table: Benchmarking of rowAnyMissings(), apply+anyMissing() and rowSums() on integer+100x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 0.056641 | 0.0609035 | 0.0615156 | 0.0614335 | 0.0622650 | 0.073963 | 
| 3 | rowSums | 0.274373 | 0.2902230 | 0.2940135 | 0.2974325 | 0.2991725 | 0.325074 | 
| 2 | apply+anyMissing | 1.537276 | 1.6170405 | 1.6635327 | 1.6565425 | 1.7144425 | 1.926334 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 1.00000 | 1.000000 | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | rowSums | 4.84407 | 4.765293 | 4.77950 | 4.841536 | 4.804826 | 4.395089 | 
| 2 | apply+anyMissing | 27.14069 | 26.550863 | 27.04248 | 26.964807 | 27.534610 | 26.044563 | 
Figure: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on integer+100x1000 data as well as rowAnyMissings(), apply+anyMissing() and rowSums() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

 Table: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+100x1000 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
Table: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+100x1000 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 38.997 | 40.9690 | 43.86702 | 41.9970 | 43.925 | 85.250 | 
| 2 | rowAnyMissings | 56.641 | 60.9035 | 61.51555 | 61.4335 | 62.265 | 73.963 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.00000 | 1.0000000 | 
| 2 | rowAnyMissings | 1.452445 | 1.486575 | 1.402319 | 1.462807 | 1.41753 | 0.8676012 | 
Figure: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+100x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

> X <- data[["1000x100"]]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3069486 164.0    5709258 305.0  5709258 305.0
Vcells 5204107  39.8   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings = colAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 2L, 
+     FUN = anyMissing), colSums = is.na(colSums(X, na.rm = FALSE)), unit = "ms")
> X <- t(X)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3069480 164.0    5709258 305.0  5709258 305.0
Vcells 5254150  40.1   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings = rowAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 1L, 
+     FUN = anyMissing), rowSums = is.na(rowSums(X, na.rm = FALSE)), unit = "ms")Table: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on integer+1000x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 0.030001 | 0.0319850 | 0.0327559 | 0.0328565 | 0.0333575 | 0.040529 | 
| 3 | colSums | 0.081262 | 0.0834525 | 0.0868371 | 0.0865440 | 0.0888915 | 0.115576 | 
| 2 | apply+anyMissing | 0.593065 | 0.6077225 | 0.6206371 | 0.6201165 | 0.6279245 | 0.743372 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | colSums | 2.708643 | 2.609114 | 2.651037 | 2.633999 | 2.664813 | 2.851686 | 
| 2 | apply+anyMissing | 19.768174 | 19.000235 | 18.947344 | 18.873480 | 18.824088 | 18.341731 | 
Table: Benchmarking of rowAnyMissings(), apply+anyMissing() and rowSums() on integer+1000x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 0.062917 | 0.0650115 | 0.0713341 | 0.0667215 | 0.068170 | 0.125828 | 
| 3 | rowSums | 0.373836 | 0.3787040 | 0.3901189 | 0.3946015 | 0.396410 | 0.417912 | 
| 2 | apply+anyMissing | 0.620900 | 0.6357370 | 0.6547821 | 0.6440605 | 0.654291 | 1.084129 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | rowSums | 5.941733 | 5.825185 | 5.468899 | 5.914158 | 5.815021 | 3.321296 | 
| 2 | apply+anyMissing | 9.868557 | 9.778839 | 9.179092 | 9.652968 | 9.597932 | 8.615960 | 
Figure: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on integer+1000x100 data as well as rowAnyMissings(), apply+anyMissing() and rowSums() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

 Table: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+1000x100 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
Table: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+1000x100 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 30.001 | 31.9850 | 32.75589 | 32.8565 | 33.3575 | 40.529 | 
| 2 | rowAnyMissings | 62.917 | 65.0115 | 71.33408 | 66.7215 | 68.1700 | 125.828 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 2 | rowAnyMissings | 2.097163 | 2.032562 | 2.177748 | 2.030694 | 2.043618 | 3.104641 | 
Figure: Benchmarking of colAnyMissings() and rowAnyMissings() on integer+1000x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

> rmatrix <- function(nrow, ncol, mode = c("logical", "double", "integer", "index"), range = c(-100, 
+     +100), na_prob = 0) {
+     mode <- match.arg(mode)
+     n <- nrow * ncol
+     if (mode == "logical") {
+         x <- sample(c(FALSE, TRUE), size = n, replace = TRUE)
+     }     else if (mode == "index") {
+         x <- seq_len(n)
+         mode <- "integer"
+     }     else {
+         x <- runif(n, min = range[1], max = range[2])
+     }
+     storage.mode(x) <- mode
+     if (na_prob > 0) 
+         x[sample(n, size = na_prob * n)] <- NA
+     dim(x) <- c(nrow, ncol)
+     x
+ }
> rmatrices <- function(scale = 10, seed = 1, ...) {
+     set.seed(seed)
+     data <- list()
+     data[[1]] <- rmatrix(nrow = scale * 1, ncol = scale * 1, ...)
+     data[[2]] <- rmatrix(nrow = scale * 10, ncol = scale * 10, ...)
+     data[[3]] <- rmatrix(nrow = scale * 100, ncol = scale * 1, ...)
+     data[[4]] <- t(data[[3]])
+     data[[5]] <- rmatrix(nrow = scale * 10, ncol = scale * 100, ...)
+     data[[6]] <- t(data[[5]])
+     names(data) <- sapply(data, FUN = function(x) paste(dim(x), collapse = "x"))
+     data
+ }
> data <- rmatrices(mode = mode)> X <- data[["10x10"]]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3069700 164.0    5709258 305.0  5709258 305.0
Vcells 5319929  40.6   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings = colAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 2L, 
+     FUN = anyMissing), colSums = is.na(colSums(X, na.rm = FALSE)), unit = "ms")
> X <- t(X)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3069682 164.0    5709258 305.0  5709258 305.0
Vcells 5320052  40.6   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings = rowAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 1L, 
+     FUN = anyMissing), rowSums = is.na(rowSums(X, na.rm = FALSE)), unit = "ms")Table: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on double+10x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 0.001819 | 0.0022745 | 0.0035873 | 0.002755 | 0.0033560 | 0.031580 | 
| 3 | colSums | 0.003137 | 0.0037025 | 0.0056931 | 0.004514 | 0.0050970 | 0.064079 | 
| 2 | apply+anyMissing | 0.022773 | 0.0236325 | 0.0307131 | 0.024044 | 0.0330695 | 0.084984 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | colSums | 1.724574 | 1.62783 | 1.587011 | 1.638475 | 1.518772 | 2.029101 | 
| 2 | apply+anyMissing | 12.519516 | 10.39020 | 8.561599 | 8.727405 | 9.853844 | 2.691070 | 
Table: Benchmarking of rowAnyMissings(), apply+anyMissing() and rowSums() on double+10x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 0.001620 | 0.0019670 | 0.0025163 | 0.0023535 | 0.0025445 | 0.022849 | 
| 3 | rowSums | 0.002514 | 0.0029355 | 0.0039530 | 0.0033415 | 0.0038405 | 0.052999 | 
| 2 | apply+anyMissing | 0.021953 | 0.0228160 | 0.0246138 | 0.0231025 | 0.0234995 | 0.124548 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | rowSums | 1.551852 | 1.492374 | 1.570960 | 1.419800 | 1.509334 | 2.319533 | 
| 2 | apply+anyMissing | 13.551235 | 11.599390 | 9.781872 | 9.816231 | 9.235410 | 5.450917 | 
Figure: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on double+10x10 data as well as rowAnyMissings(), apply+anyMissing() and rowSums() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

 Table: Benchmarking of colAnyMissings() and rowAnyMissings() on double+10x10 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
Table: Benchmarking of colAnyMissings() and rowAnyMissings() on double+10x10 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 2 | rowAnyMissings | 1.620 | 1.9670 | 2.51627 | 2.3535 | 2.5445 | 22.849 | 
| 1 | colAnyMissings | 1.819 | 2.2745 | 3.58731 | 2.7550 | 3.3560 | 31.580 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 2 | rowAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 1 | colAnyMissings | 1.122839 | 1.156329 | 1.425646 | 1.170597 | 1.318923 | 1.382117 | 
Figure: Benchmarking of colAnyMissings() and rowAnyMissings() on double+10x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

> X <- data[["100x100"]]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3069893 164.0    5709258 305.0  5709258 305.0
Vcells 5320834  40.6   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings = colAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 2L, 
+     FUN = anyMissing), colSums = is.na(colSums(X, na.rm = FALSE)), unit = "ms")
> X <- t(X)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3069887 164.0    5709258 305.0  5709258 305.0
Vcells 5330877  40.7   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings = rowAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 1L, 
+     FUN = anyMissing), rowSums = is.na(rowSums(X, na.rm = FALSE)), unit = "ms")Table: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on double+100x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 0.007107 | 0.0076770 | 0.0081280 | 0.0080405 | 0.0083785 | 0.018760 | 
| 3 | colSums | 0.010312 | 0.0110705 | 0.0118222 | 0.0116055 | 0.0121975 | 0.026635 | 
| 2 | apply+anyMissing | 0.208762 | 0.2103105 | 0.2168101 | 0.2117025 | 0.2160180 | 0.356309 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.00000 | 1.00000 | 1.000000 | 1.000000 | 
| 3 | colSums | 1.450964 | 1.442035 | 1.45449 | 1.44338 | 1.455809 | 1.419776 | 
| 2 | apply+anyMissing | 29.374138 | 27.394881 | 26.67434 | 26.32952 | 25.782419 | 18.993017 | 
Table: Benchmarking of rowAnyMissings(), apply+anyMissing() and rowSums() on double+100x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 0.008187 | 0.0085160 | 0.0090631 | 0.0089225 | 0.0091945 | 0.019184 | 
| 3 | rowSums | 0.021389 | 0.0219900 | 0.0225394 | 0.0225180 | 0.0228760 | 0.030473 | 
| 2 | apply+anyMissing | 0.166758 | 0.1688355 | 0.1743099 | 0.1698705 | 0.1729725 | 0.273976 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | rowSums | 2.612557 | 2.582198 | 2.486937 | 2.523732 | 2.488009 | 1.588459 | 
| 2 | apply+anyMissing | 20.368633 | 19.825681 | 19.232899 | 19.038442 | 18.812605 | 14.281485 | 
Figure: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on double+100x100 data as well as rowAnyMissings(), apply+anyMissing() and rowSums() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

 Table: Benchmarking of colAnyMissings() and rowAnyMissings() on double+100x100 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
Table: Benchmarking of colAnyMissings() and rowAnyMissings() on double+100x100 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 7.107 | 7.677 | 8.12804 | 8.0405 | 8.3785 | 18.760 | 
| 2 | rowAnyMissings | 8.187 | 8.516 | 9.06311 | 8.9225 | 9.1945 | 19.184 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 2 | rowAnyMissings | 1.151963 | 1.109287 | 1.115042 | 1.109695 | 1.097392 | 1.022601 | 
Figure: Benchmarking of colAnyMissings() and rowAnyMissings() on double+100x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

> X <- data[["1000x10"]]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3070109 164.0    5709258 305.0  5709258 305.0
Vcells 5321890  40.7   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings = colAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 2L, 
+     FUN = anyMissing), colSums = is.na(colSums(X, na.rm = FALSE)), unit = "ms")
> X <- t(X)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3070100 164.0    5709258 305.0  5709258 305.0
Vcells 5331928  40.7   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings = rowAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 1L, 
+     FUN = anyMissing), rowSums = is.na(rowSums(X, na.rm = FALSE)), unit = "ms")Table: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on double+1000x10 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 0.006251 | 0.006547 | 0.0073076 | 0.0069710 | 0.0073350 | 0.018011 | 
| 3 | colSums | 0.011060 | 0.011543 | 0.0125758 | 0.0124015 | 0.0130405 | 0.027134 | 
| 2 | apply+anyMissing | 0.116353 | 0.117901 | 0.1243409 | 0.1200470 | 0.1243990 | 0.223303 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | colSums | 1.769317 | 1.763098 | 1.720933 | 1.779013 | 1.777846 | 1.506524 | 
| 2 | apply+anyMissing | 18.613502 | 18.008401 | 17.015376 | 17.220915 | 16.959646 | 12.398146 | 
Table: Benchmarking of rowAnyMissings(), apply+anyMissing() and rowSums() on double+1000x10 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 0.007567 | 0.0080310 | 0.0088064 | 0.0084455 | 0.008688 | 0.044808 | 
| 3 | rowSums | 0.021999 | 0.0224215 | 0.0232173 | 0.0229490 | 0.023306 | 0.045368 | 
| 2 | apply+anyMissing | 0.075030 | 0.0781560 | 0.0822301 | 0.0791490 | 0.081567 | 0.145654 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | rowSums | 2.907229 | 2.791869 | 2.636427 | 2.717305 | 2.682551 | 1.012498 | 
| 2 | apply+anyMissing | 9.915422 | 9.731789 | 9.337580 | 9.371736 | 9.388467 | 3.250625 | 
Figure: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on double+1000x10 data as well as rowAnyMissings(), apply+anyMissing() and rowSums() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

 Table: Benchmarking of colAnyMissings() and rowAnyMissings() on double+1000x10 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
Table: Benchmarking of colAnyMissings() and rowAnyMissings() on double+1000x10 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 6.251 | 6.547 | 7.30756 | 6.9710 | 7.335 | 18.011 | 
| 2 | rowAnyMissings | 7.567 | 8.031 | 8.80636 | 8.4455 | 8.688 | 44.808 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 2 | rowAnyMissings | 1.210526 | 1.226669 | 1.205103 | 1.211519 | 1.184458 | 2.487813 | 
Figure: Benchmarking of colAnyMissings() and rowAnyMissings() on double+1000x10 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

> X <- data[["10x1000"]]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3070311 164.0    5709258 305.0  5709258 305.0
Vcells 5322021  40.7   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings = colAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 2L, 
+     FUN = anyMissing), colSums = is.na(colSums(X, na.rm = FALSE)), unit = "ms")
> X <- t(X)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3070305 164.0    5709258 305.0  5709258 305.0
Vcells 5332064  40.7   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings = rowAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 1L, 
+     FUN = anyMissing), rowSums = is.na(rowSums(X, na.rm = FALSE)), unit = "ms")Table: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on double+10x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 0.008865 | 0.010012 | 0.0109351 | 0.010653 | 0.0115545 | 0.021670 | 
| 3 | colSums | 0.012431 | 0.013672 | 0.0148562 | 0.014700 | 0.0155670 | 0.028429 | 
| 2 | apply+anyMissing | 1.023012 | 1.117141 | 1.1719342 | 1.175741 | 1.2425840 | 1.353891 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | colSums | 1.402256 | 1.365561 | 1.358581 | 1.379893 | 1.347267 | 1.311906 | 
| 2 | apply+anyMissing | 115.398985 | 111.580154 | 107.171888 | 110.367080 | 107.541131 | 62.477665 | 
Table: Benchmarking of rowAnyMissings(), apply+anyMissing() and rowSums() on double+10x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 0.008871 | 0.0100845 | 0.0114888 | 0.0110380 | 0.012122 | 0.026134 | 
| 3 | rowSums | 0.020792 | 0.0226130 | 0.0248835 | 0.0234955 | 0.025047 | 0.072088 | 
| 2 | apply+anyMissing | 1.021304 | 1.1250015 | 1.1898753 | 1.1814915 | 1.248977 | 1.769955 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | rowSums | 2.343817 | 2.242352 | 2.165891 | 2.128601 | 2.066243 | 2.758399 | 
| 2 | apply+anyMissing | 115.128396 | 111.557489 | 103.568377 | 107.038549 | 103.033905 | 67.726142 | 
Figure: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on double+10x1000 data as well as rowAnyMissings(), apply+anyMissing() and rowSums() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

 Table: Benchmarking of colAnyMissings() and rowAnyMissings() on double+10x1000 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
Table: Benchmarking of colAnyMissings() and rowAnyMissings() on double+10x1000 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 8.865 | 10.0120 | 10.93509 | 10.653 | 11.5545 | 21.670 | 
| 2 | rowAnyMissings | 8.871 | 10.0845 | 11.48879 | 11.038 | 12.1220 | 26.134 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.00000 | 1.000000 | 1.000000 | 
| 2 | rowAnyMissings | 1.000677 | 1.007241 | 1.050635 | 1.03614 | 1.049115 | 1.205999 | 
Figure: Benchmarking of colAnyMissings() and rowAnyMissings() on double+10x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

> X <- data[["100x1000"]]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3070524 164.0    5709258 305.0  5709258 305.0
Vcells 5323260  40.7   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings = colAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 2L, 
+     FUN = anyMissing), colSums = is.na(colSums(X, na.rm = FALSE)), unit = "ms")
> X <- t(X)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3070518 164.0    5709258 305.0  5709258 305.0
Vcells 5423303  41.4   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings = rowAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 1L, 
+     FUN = anyMissing), rowSums = is.na(rowSums(X, na.rm = FALSE)), unit = "ms")Table: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on double+100x1000 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 0.054174 | 0.059639 | 0.0664943 | 0.0614840 | 0.068437 | 0.146194 | 
| 3 | colSums | 0.068635 | 0.076323 | 0.0839455 | 0.0793505 | 0.085531 | 0.298706 | 
| 2 | apply+anyMissing | 1.976548 | 2.114569 | 2.3397263 | 2.1820875 | 2.237111 | 15.016490 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | colSums | 1.266936 | 1.27975 | 1.262446 | 1.290588 | 1.249777 | 2.043217 | 
| 2 | apply+anyMissing | 36.485177 | 35.45615 | 35.186849 | 35.490331 | 32.688619 | 102.716185 | 
Table: Benchmarking of rowAnyMissings(), apply+anyMissing() and rowSums() on double+100x1000 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 0.057760 | 0.0629830 | 0.0676968 | 0.065282 | 0.071874 | 0.099589 | 
| 3 | rowSums | 0.182438 | 0.1947895 | 0.2059753 | 0.203771 | 0.212620 | 0.262827 | 
| 2 | apply+anyMissing | 1.543800 | 1.6446905 | 1.8434543 | 1.695164 | 1.753697 | 13.961009 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | rowSums | 3.158553 | 3.092731 | 3.042616 | 3.121396 | 2.958232 | 2.639117 | 
| 2 | apply+anyMissing | 26.727839 | 26.113245 | 27.231048 | 25.966783 | 24.399602 | 140.186255 | 
Figure: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on double+100x1000 data as well as rowAnyMissings(), apply+anyMissing() and rowSums() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

 Table: Benchmarking of colAnyMissings() and rowAnyMissings() on double+100x1000 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
Table: Benchmarking of colAnyMissings() and rowAnyMissings() on double+100x1000 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 54.174 | 59.639 | 66.49434 | 61.484 | 68.437 | 146.194 | 
| 2 | rowAnyMissings | 57.760 | 62.983 | 67.69678 | 65.282 | 71.874 | 99.589 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.0000000 | 
| 2 | rowAnyMissings | 1.066194 | 1.056071 | 1.018083 | 1.061772 | 1.050221 | 0.6812113 | 
Figure: Benchmarking of colAnyMissings() and rowAnyMissings() on double+100x1000 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

> X <- data[["1000x100"]]
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3070739 164.0    5709258 305.0  5709258 305.0
Vcells 5323408  40.7   22267496 169.9 56666022 432.4
> colStats <- microbenchmark(colAnyMissings = colAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 2L, 
+     FUN = anyMissing), colSums = is.na(colSums(X, na.rm = FALSE)), unit = "ms")
> X <- t(X)
> gc()
          used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells 3070730 164.0    5709258 305.0  5709258 305.0
Vcells 5423446  41.4   22267496 169.9 56666022 432.4
> rowStats <- microbenchmark(rowAnyMissings = rowAnyMissings(X), `apply+anyMissing` = apply(X, MARGIN = 1L, 
+     FUN = anyMissing), rowSums = is.na(rowSums(X, na.rm = FALSE)), unit = "ms")Table: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on double+1000x100 data. The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 0.045287 | 0.0481780 | 0.0509085 | 0.0498250 | 0.0525545 | 0.086146 | 
| 3 | colSums | 0.079204 | 0.0820255 | 0.0851201 | 0.0843330 | 0.0867525 | 0.108378 | 
| 2 | apply+anyMissing | 0.601911 | 0.6307570 | 0.7094821 | 0.6432745 | 0.6718125 | 5.878546 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.00000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | colSums | 1.748935 | 1.702551 | 1.67202 | 1.692584 | 1.650715 | 1.258074 | 
| 2 | apply+anyMissing | 13.291033 | 13.092220 | 13.93641 | 12.910677 | 12.783158 | 68.239338 | 
Table: Benchmarking of rowAnyMissings(), apply+anyMissing() and rowSums() on double+1000x100 data (transposed). The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 0.062566 | 0.067849 | 0.0705182 | 0.0703415 | 0.072111 | 0.097521 | 
| 3 | rowSums | 0.190387 | 0.202358 | 0.2105402 | 0.2118745 | 0.214736 | 0.238846 | 
| 2 | apply+anyMissing | 0.652861 | 0.690647 | 0.7667233 | 0.7038675 | 0.732173 | 6.031251 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | rowAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 3 | rowSums | 3.042979 | 2.982476 | 2.985615 | 3.012084 | 2.977854 | 2.449175 | 
| 2 | apply+anyMissing | 10.434757 | 10.179177 | 10.872702 | 10.006433 | 10.153416 | 61.845664 | 
Figure: Benchmarking of colAnyMissings(), apply+anyMissing() and colSums() on double+1000x100 data as well as rowAnyMissings(), apply+anyMissing() and rowSums() on the same data transposed. Outliers are displayed as crosses. Times are in milliseconds.

 Table: Benchmarking of colAnyMissings() and rowAnyMissings() on double+1000x100 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
Table: Benchmarking of colAnyMissings() and rowAnyMissings() on double+1000x100 data (original and transposed).  The top panel shows times in milliseconds and the bottom panel shows relative times.
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 45.287 | 48.178 | 50.90852 | 49.8250 | 52.5545 | 86.146 | 
| 2 | rowAnyMissings | 62.566 | 67.849 | 70.51819 | 70.3415 | 72.1110 | 97.521 | 
| expr | min | lq | mean | median | uq | max | |
|---|---|---|---|---|---|---|---|
| 1 | colAnyMissings | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 
| 2 | rowAnyMissings | 1.381544 | 1.408298 | 1.385194 | 1.411771 | 1.372119 | 1.132043 | 
Figure: Benchmarking of colAnyMissings() and rowAnyMissings() on double+1000x100 data (original and transposed). Outliers are displayed as crosses. Times are in milliseconds.

R version 3.6.1 Patched (2019-08-27 r77078)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS
Matrix products: default
BLAS:   /home/hb/software/R-devel/R-3-6-branch/lib/R/lib/libRblas.so
LAPACK: /home/hb/software/R-devel/R-3-6-branch/lib/R/lib/libRlapack.so
locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
[1] microbenchmark_1.4-6    matrixStats_0.55.0-9000 ggplot2_3.2.1          
[4] knitr_1.24              R.devices_2.16.0        R.utils_2.9.0          
[7] R.oo_1.22.0             R.methodsS3_1.7.1       history_0.0.0-9002     
loaded via a namespace (and not attached):
 [1] Biobase_2.45.0       bit64_0.9-7          splines_3.6.1       
 [4] network_1.15         assertthat_0.2.1     highr_0.8           
 [7] stats4_3.6.1         blob_1.2.0           robustbase_0.93-5   
[10] pillar_1.4.2         RSQLite_2.1.2        backports_1.1.4     
[13] lattice_0.20-38      glue_1.3.1           digest_0.6.20       
[16] colorspace_1.4-1     sandwich_2.5-1       Matrix_1.2-17       
[19] XML_3.98-1.20        lpSolve_5.6.13.3     pkgconfig_2.0.2     
[22] genefilter_1.66.0    purrr_0.3.2          ergm_3.10.4         
[25] xtable_1.8-4         mvtnorm_1.0-11       scales_1.0.0        
[28] tibble_2.1.3         annotate_1.62.0      IRanges_2.18.2      
[31] TH.data_1.0-10       withr_2.1.2          BiocGenerics_0.30.0 
[34] lazyeval_0.2.2       mime_0.7             survival_2.44-1.1   
[37] magrittr_1.5         crayon_1.3.4         statnet.common_4.3.0
[40] memoise_1.1.0        laeken_0.5.0         R.cache_0.13.0      
[43] MASS_7.3-51.4        R.rsp_0.43.1         tools_3.6.1         
[46] multcomp_1.4-10      S4Vectors_0.22.1     trust_0.1-7         
[49] munsell_0.5.0        AnnotationDbi_1.46.1 compiler_3.6.1      
[52] rlang_0.4.0          grid_3.6.1           RCurl_1.95-4.12     
[55] cwhmisc_6.6          rappdirs_0.3.1       labeling_0.3        
[58] bitops_1.0-6         base64enc_0.1-3      boot_1.3-23         
[61] gtable_0.3.0         codetools_0.2-16     DBI_1.0.0           
[64] markdown_1.1         R6_2.4.0             zoo_1.8-6           
[67] dplyr_0.8.3          bit_1.1-14           zeallot_0.1.0       
[70] parallel_3.6.1       Rcpp_1.0.2           vctrs_0.2.0         
[73] DEoptimR_1.0-8       tidyselect_0.2.5     xfun_0.9            
[76] coda_0.19-3         Total processing time was 24.03 secs.
To reproduce this report, do:
html <- matrixStats:::benchmark('colAnyMissings')Copyright Henrik Bengtsson. Last updated on 2019-09-10 20:35:46 (-0700 UTC). Powered by RSP.
<script> var link = document.createElement('link'); link.rel = 'icon'; link.href = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAA21BMVEUAAAAAAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8AAP8BAf4CAv0DA/wdHeIeHuEfH+AgIN8hId4lJdomJtknJ9g+PsE/P8BAQL9yco10dIt1dYp3d4h4eIeVlWqWlmmXl2iYmGeZmWabm2Tn5xjo6Bfp6Rb39wj4+Af//wA2M9hbAAAASXRSTlMAAQIJCgsMJSYnKD4/QGRlZmhpamtsbautrrCxuru8y8zN5ebn6Pn6+///////////////////////////////////////////LsUNcQAAAS9JREFUOI29k21XgkAQhVcFytdSMqMETU26UVqGmpaiFbL//xc1cAhhwVNf6n5i5z67M2dmYOyfJZUqlVLhkKucG7cgmUZTybDz6g0iDeq51PUr37Ds2cy2/C9NeES5puDjxuUk1xnToZsg8pfA3avHQ3lLIi7iWRrkv/OYtkScxBIMgDee0ALoyxHQBJ68JLCjOtQIMIANF7QG9G9fNnHvisCHBVMKgSJgiz7nE+AoBKrAPA3MgepvgR9TSCasrCKH0eB1wBGBFdCO+nAGjMVGPcQb5bd6mQRegN6+1axOs9nGfYcCtfi4NQosdtH7dB+txFIpXQqN1p9B/asRHToyS0jRgpV7nk4nwcq1BJ+x3Gl/v7S9Wmpp/aGquum7w3ZDyrADFYrl8vHBH+ev9AUASW1dmU4h4wAAAABJRU5ErkJggg==" document.getElementsByTagName('head')[0].appendChild(link); </script>