rowTabulates | R Documentation |
Tabulates the values in a matrix-like object by row (column).
rowTabulates(x, rows = NULL, cols = NULL, values = NULL, ...,
useNames = TRUE)
## S4 method for signature 'matrix_OR_array_OR_table_OR_numeric'
rowTabulates(x, rows = NULL,
cols = NULL, values = NULL, ..., useNames = TRUE)
## S4 method for signature 'ANY'
rowTabulates(x, rows = NULL, cols = NULL, values = NULL,
..., useNames = TRUE)
colTabulates(x, rows = NULL, cols = NULL, values = NULL, ...,
useNames = TRUE)
## S4 method for signature 'matrix_OR_array_OR_table_OR_numeric'
colTabulates(x, rows = NULL,
cols = NULL, values = NULL, ..., useNames = TRUE)
## S4 method for signature 'ANY'
colTabulates(x, rows = NULL, cols = NULL, values = NULL,
..., useNames = TRUE)
x |
An NxK matrix-like object. |
rows , cols |
A |
values |
the values to search for. |
... |
Additional arguments passed to specific methods. |
useNames |
If |
The S4 methods for x
of type matrix
,
array
, table
, or numeric
call
matrixStats::rowTabulates
/
matrixStats::colTabulates
.
a numeric
NxJ
(KxJ
)
matrix
, where N (K) is the number of rows (columns) for
which the J values are calculated.
matrixStats::rowTabulates()
and
matrixStats::colTabulates()
which
are used when the input is a matrix
or numeric
vector.
base::table()
mat <- matrix(rpois(15, lambda = 3), nrow = 5, ncol = 3)
mat[2, 1] <- NA_integer_
mat[3, 3] <- 0L
mat[4, 1] <- 0L
print(mat)
rowTabulates(mat)
colTabulates(mat)
rowTabulates(mat, values = 0)
colTabulates(mat, values = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.