tbl_check_is_table: Checks that an object is a table

View source: R/tbl_check_is_table.R

tbl_check_is_tableR Documentation

Checks that an object is a table

Description

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()

Usage

tbl_check_is_table(object = .result, env = parent.frame())

tbl_grade_is_table(object = .result, env = parent.frame(), ...)

Arguments

object

An object to be compared to expected.

env

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

Include a random encouraging phrase with random_encouragement()? The default value of encourage can be set using gradethis_setup() or the gradethis.fail.encourage option.

Value

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.

Problems

  1. not_table: The object is not a table

Examples

.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()
tbl_grade_is_table()

rstudio/tblcheck documentation built on March 11, 2023, 5:42 p.m.