Checks if object
inherits the data.frame class.
If the not
tbl_check_is_table()
returns a list describing the problem
tbl_grade_is_table()
returns a failing grade and
informative message with gradethis::fail()
tbl_check_is_table(object = .result, env = parent.frame())
tbl_grade_is_table(object = .result, env = parent.frame(), ...)
An object to be compared to expected
.
The environment in which to find .result
and .solution
.
Arguments passed on to gradethis::fail
hint
Include a code feedback hint with the failing message? This
argument only applies to fail()
and fail_if_equal()
and the message is
added using the default options of give_code_feedback()
and
maybe_code_feedback()
. The default value of hint
can be set using
gradethis_setup()
or the gradethis.fail.hint
option.
encourage
Incude a random encouraging phrase with
random_encouragement()
? The default value of encourage
can be set
using gradethis_setup()
or the gradethis.fail.encourage
option.
If there are any issues, a list from tbl_check_is_table()
or a
gradethis::fail()
message from tbl_grade_is_table()
.
Otherwise, invisibly returns NULL
.
.result <- data.frame(a = 1:10)
tbl_check_is_table()
tbl_grade_is_table()
.result <- tibble::tibble(a = 1:10)
tbl_check_is_table()
tbl_grade_is_table()
.result <- list(a = 1:10)
tbl_check_is_table()
#> <tblcheck problem>
#> Your result should be a table, but it is a list (class `list`).
#> $ type : chr "not_table"
#> $ expected : chr "data.frame"
#> $ actual : chr "list"
#> $ actual_length: int 1
tbl_grade_is_table()
#> <gradethis_graded: [Incorrect]
#> Your result should be a table, but it is a list (class `list`).
#> >