is_tbl: Is the input a tbl?

Description Usage Arguments Value See Also Examples

View source: R/is-type-dplyr.R

Description

Checks to see if the input is a tbl.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
assert_is_tbl(x, severity = getOption("assertive.severity", "stop"))

assert_is_tbl_cube(x, severity = getOption("assertive.severity", "stop"))

assert_is_tbl_df(x, severity = getOption("assertive.severity", "stop"))

assert_is_tbl_dt(x, severity = getOption("assertive.severity", "stop"))

is_tbl(x, .xname = get_name_in_parent(x))

is_tbl_cube(x, .xname = get_name_in_parent(x))

is_tbl_df(x, .xname = get_name_in_parent(x))

is_tbl_dt(x, .xname = get_name_in_parent(x))

Arguments

x

Input to check.

severity

How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".

.xname

Not intended to be used directly.

Value

is_data.table wraps is.data.table, providing more information on failure. The assert_* functions return nothing but throws an error if the corresponding is_* function returns FALSE.

See Also

is.data.table.

Examples

1
2
3
4
5
6
7
8
9
if(requireNamespace("dplyr"))
{
  assert_is_tbl_df(dplyr::tbl_df(data.frame(x = 1:5)))
  #These examples should fail.
  assertive.base::dont_stop(assert_is_tbl(data.frame(x = 1:5)))
} else
{
  message("This example requires the data.table package to be installed.")
}

assertive.types documentation built on May 1, 2019, 10:31 p.m.