View source: R/tbl_check_names.R
tbl_check_names | R Documentation |
Checks if object
and expected
have the same names.
If the names differ
tbl_check_names()
and vec_check_names()
returns a list describing
the problem
tbl_grade_names()
and vec_grade_names()
returns a failing grade and
informative message with gradethis::fail()
tbl_check_names( object = .result, expected = .solution, check_order = TRUE, env = parent.frame() ) vec_check_names( object = .result, expected = .solution, check_order = TRUE, env = parent.frame() ) tbl_grade_names( object = .result, expected = .solution, max_diffs = 3, check_order = TRUE, env = parent.frame(), ... ) vec_grade_names( object = .result, expected = .solution, max_diffs = 3, check_order = TRUE, env = parent.frame(), ... )
object |
An object to be compared to |
expected |
An object containing the expected result. |
check_order |
|
env |
The environment in which to find |
max_diffs |
|
... |
Arguments passed on to
|
If there are any issues, a list from tbl_check_names()
and
vec_check_names()
or a gradethis::fail()
message from
tbl_grade_names()
and vec_grade_names()
.
Otherwise, invisibly returns NULL
.
names
: The object has names that are not expected,
or is missing names that are expected.
names_order
: The object has the same names as expected,
but in a different order.
.result <- c(1, 2, 3, 4, 5, 6, 7) .solution <- c(a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7) vec_check_names() vec_grade_names() vec_grade_names(max_diffs = 5) vec_grade_names(max_diffs = Inf) .result <- tibble::tibble(a = 1:5, b = 6:10, c = 11:15) .solution <- tibble::tibble(a = 1:5, x = 6:10, y = 11:15) tbl_check_names() tbl_grade_names()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.