View source: R/checkPermutation.R
| checkPermutation | R Documentation |
In contrast to checkSetEqual, the function tests for a true
permutation of the two vectors and also considers duplicated values.
Missing values are being treated as actual values by default.
Does not work on raw values.
checkPermutation(x, y, na.ok = TRUE)
check_permutation(x, y, na.ok = TRUE)
assertPermutation(x, y, na.ok = TRUE, .var.name = vname(x), add = NULL)
assert_permutation(x, y, na.ok = TRUE, .var.name = vname(x), add = NULL)
testPermutation(x, y, na.ok = TRUE)
test_permutation(x, y, na.ok = TRUE)
expect_permutation(x, y, na.ok = TRUE, info = NULL, label = vname(x))
x |
[ |
y |
[ |
na.ok |
[ |
.var.name |
[ |
add |
[ |
info |
[ |
label |
[ |
Depending on the function prefix:
If the check is successful, the functions
assertPermutation/assert_permutation return
x invisibly, whereas
checkPermutation/check_permutation and
testPermutation/test_permutation return
TRUE.
If the check is not successful,
assertPermutation/assert_permutation
throws an error message,
testPermutation/test_permutation
returns FALSE,
and checkPermutation/check_permutation
return a string with the error message.
The function expect_permutation always returns an
expectation.
The object x must be of the same type as the set w.r.t. typeof.
Integers and doubles are both treated as numeric.
Other set:
checkChoice(),
checkDisjunct(),
checkSetEqual(),
checkSubset()
testPermutation(letters[1:2], letters[2:1])
testPermutation(letters[c(1, 1, 2)], letters[1:2])
testPermutation(c(NA, 1, 2), c(1, 2, NA))
testPermutation(c(NA, 1, 2), c(1, 2, NA), na.ok = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.