is_matrix {riskyr} | R Documentation |
Verify a 2x2 matrix as a numeric contingency table.
Description
is_matrix
verifies that mx
is a
valid 2x2 matrix (i.e., a numeric contingency table).
Usage
is_matrix(mx)
Arguments
mx |
An object to verify (required). |
Details
is_matrix
is more restrictive than is.matrix
,
as it also requires that mx
is.numeric
,
is.table
, nrows(mx) == 2
, and ncols(mx) == 2
.
Value
A Boolean value: TRUE
if mx
is a numeric matrix and 2x2 contingency table;
otherwise FALSE
.
References
Neth, H., Gradwohl, N., Streeb, D., Keim, D.A., & Gaissmaier, W. (2021). Perspectives on the 2×2 matrix: Solving semantically distinct problems based on a shared structure of binary contingencies. Frontiers in Psychology, 11, 567817. doi: doi: 10.3389/fpsyg.2020.567817
See Also
Other verification functions:
is_complement()
,
is_extreme_prob_set()
,
is_freq()
,
is_integer()
,
is_perc()
,
is_prob()
,
is_suff_prob_set()
,
is_valid_prob_pair()
,
is_valid_prob_set()
,
is_valid_prob_triple()
Examples
is_matrix(1:4)
is_matrix(matrix("A"))
is_matrix(matrix(1:4))
is_matrix(as.table(matrix(1:4, nrow = 1, ncol = 4)))
is_matrix(as.table(matrix(1:4, nrow = 4, ncol = 1)))
is_matrix(as.table(matrix(1:4, nrow = 2, ncol = 2)))