/usr/lib/R/site-library/matrixStats/benchmarking/colRowCounts.md.rsp is in r-cran-matrixstats 0.14.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | <%@include file="includes/setup.md.rsp"%>
<%@string colname="colCounts"%>
<%@string rowname="rowCounts"%>
<%@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
* colSums() and rowSums()
* apply() + sum()
<% for (mode in c("logical", "integer", "double")) { %>
## Data type "<%=mode%>"
### Data
```r
<%=withCapture({
<%@include file="R/random-matrices.R"%>
data <- rmatrices(mode=mode)
})%>
```
### Results
<% for (dataLabel in names(data)) { %>
<% message(dataLabel) %>
#### <%=dataLabel%> matrix
```r
<%=withCapture({
X <- data[[.dataLabel.]]
value <- 42
})%>
```
<% gc() %>
```r
<%=withCapture({
colStats <- microbenchmark(
colCounts = colCounts(X, value=value, na.rm=FALSE),
colSums = colSums(X == value, na.rm=FALSE),
"apply+sum" = apply(X, MARGIN=2L, FUN=function(x) sum(x == value, na.rm=FALSE)),
unit = "ms"
)
})%>
```
```r
<%=withCapture({
X <- t(X)
})%>
```
<% gc() %>
```r
<%=withCapture({
rowStats <- microbenchmark(
rowCounts = rowCounts(X, value=value, na.rm=FALSE),
rowSums = rowSums(X == value, na.rm=FALSE),
"apply+sum" = apply(X, MARGIN=1L, FUN=function(x) sum(x == value, 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.
---------------------------------------------------------------------------%>
|