View source: R/tbl_check_dimensions.R
tbl_check_dimensions | R Documentation |
Checks if object
and expected
have the same dimenisons.
If the dimensions differ
tbl_check_dimensions()
returns a list describing the problem
tbl_grade_dimensions()
returns a failing grade and informative message
with gradethis::fail()
tbl_check_dimensions( object = .result, expected = .solution, check_ncol = TRUE, env = parent.frame() ) vec_check_dimensions( object = .result, expected = .solution, check_ncol = TRUE, env = parent.frame() ) vec_check_length( object = .result, expected = .solution, check_ncol = TRUE, env = parent.frame() ) tbl_grade_dimensions( object = .result, expected = .solution, check_ncol = TRUE, env = parent.frame(), ... ) vec_grade_dimensions( object = .result, expected = .solution, check_ncol = TRUE, env = parent.frame(), ... ) vec_grade_length( object = .result, expected = .solution, check_ncol = TRUE, env = parent.frame(), ... )
object |
An object to be compared to |
expected |
An object containing the expected result. |
check_ncol |
|
env |
The environment in which to find |
... |
Arguments passed on to
|
If there are any issues, a list from tbl_check_dimensions()
or a
gradethis::fail()
message from tbl_grade_dimensions()
.
Otherwise, invisibly returns NULL
.
dimensions_n
: object
and expected
have a different number
of dimensions
length
: object
and expected
are one-dimensional vectors of
different lengths
ncol
: object
and expected
are two-dimensional objects with a
different number of columns
nrow
: object
and expected
are two-dimensional objects with a
different number of rows
dimensions
: object
and expected
are multi-dimensional arrays with
different dimensions
.result <- 1:10 .solution <- 1:5 tbl_check_dimensions() tbl_grade_dimensions() .result <- tibble::tibble(a = 1:10, b = 1:10, c = 1:10) .solution <- tibble::tibble(a = 1:10, b = 1:10) tbl_check_dimensions() tbl_grade_dimensions() .result <- tibble::tibble(a = 1:10, b = 1:10) .solution <- tibble::tibble(a = 1:5, b = 1:5) tbl_check_dimensions() tbl_grade_dimensions() .result <- 1:12 .solution <- matrix(1:12, 3) tbl_check_dimensions() tbl_grade_dimensions()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.