<%@include file="includes/setup.md.rsp"%>

<%@string colname="colAnyMissings"%>
<%@string rowname="rowAnyMissings"%>
<%@meta title="${colname}() and ${rowname}() benchmarks"%>
<%@meta author="Henrik Bengtsson"%>
<%@meta date="2014-06-09"%>

<%@include file="${header}"%>


# <%@meta name="title"%>

This report benchmark the performance of <%=colname%>() and <%=rowname%>() against alternative methods.

## Alternative methods

* colAnyMissings() and rowAnyMissings()
* apply() + anyMissing()
* colSums() + is.na() and rowSums() + is.na()

where

```r
<%=withCapture({
colAnyMissings <- function(x, ...) colAnys(x, value = NA)
})%>
```

and

```r
<%=withCapture({
rowAnyMissings <- function(x, ...) rowAnys(x, value = NA)
})%>
```

<% for (mode in c("integer", "double")) { %>

## Data type "<%=mode%>"

### Data
```r
<%=withCapture({
<%@include file="R/random-matrices.R"%>
data <- rmatrices(mode = mode)
})%>
```

## Results

<% for (dataLabel in names(data)) { %>
<% mprintf("%s: %s\n", mode, dataLabel)  %>
### <%=dataLabel%> matrix


```r
<%=withCapture({
X <- data[[.dataLabel.]]
gc()

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()

rowStats <- microbenchmark(
 rowAnyMissings     = rowAnyMissings(X),
 "apply+anyMissing" = apply(X, MARGIN = 1L, FUN = anyMissing),
 rowSums            = is.na(rowSums(X, na.rm = FALSE)),
 unit = "ms"
)
})%>
```

<% crBenchmarkResults(colStats, rowStats, tags=c(mode, dataLabel)) %>

<% } # for (dataLabel ...) %>

<% } # for (mode ...) %>


<%@include file="${footer}"%>


<%---------------------------------------------------------------------------
HISTORY:
2014-06-09
o Created.
---------------------------------------------------------------------------%>
