R/assert-is-a-type.R

Defines functions assert_is_a_bool assert_is_a_complex assert_is_a_double assert_is_a_number assert_is_a_raw assert_is_a_string assert_is_an_integer assert_is_inherited_from

Documented in assert_is_a_bool assert_is_a_complex assert_is_a_double assert_is_an_integer assert_is_a_number assert_is_a_raw assert_is_a_string assert_is_inherited_from

#' @include imports.R
#' @rdname is_logical
#' @export
assert_is_a_bool <- function(x, 
  severity = getOption("assertive.severity", "stop"))
{      
  assert_engine(
    is_a_bool, 
    x, 
    .xname = get_name_in_parent(x), 
    severity = severity
  )
}

#' @rdname is_complex
#' @export
assert_is_a_complex <- function(x, 
  severity = getOption("assertive.severity", "stop"))
{                                                          
  assert_engine(
    is_a_complex, 
    x, 
    .xname = get_name_in_parent(x), 
    severity = severity
  )
}

#' @rdname is_numeric
#' @export
assert_is_a_double <- function(x, 
  severity = getOption("assertive.severity", "stop"))
{                                                          
  assert_engine(
    is_a_double, 
    x, 
    .xname = get_name_in_parent(x), 
    severity = severity
  )
}

#' @rdname is_numeric
#' @export
assert_is_a_number <- function(x, 
  severity = getOption("assertive.severity", "stop"))
{                                                          
  assert_engine(
    is_a_number, 
    x, 
    .xname = get_name_in_parent(x), 
    severity = severity
  )
}

#' @rdname is_raw
#' @export
assert_is_a_raw <- function(x, 
  severity = getOption("assertive.severity", "stop"))
{                                                          
  assert_engine(
    is_a_raw, 
    x, 
    .xname = get_name_in_parent(x), 
    severity = severity
  ) 
}

#' @rdname is_character
#' @export
assert_is_a_string <- function(x, 
  severity = getOption("assertive.severity", "stop"))
{                                                         
  assert_engine(
    is_a_string, 
    x, 
    .xname = get_name_in_parent(x), 
    severity = severity
  )
}

#' @rdname is_integer
#' @export
assert_is_an_integer <- function(x, 
  severity = getOption("assertive.severity", "stop"))
{
  assert_engine(
    is_an_integer, 
    x, 
    .xname = get_name_in_parent(x), 
    severity = severity
  ) 
}

#' @rdname is_inherited_from
#' @export
assert_is_inherited_from <- function(x, classes, 
  severity = getOption("assertive.severity", "stop"))
{
  assert_engine(
    is_inherited_from, 
    x, 
    classes = classes, 
    .xname = get_name_in_parent(x)
  )
}

Try the assertive.types package in your browser

Any scripts or data that you put into this service are public.

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