Skip to contents

Checks if all arguments are of the same type.

Usage

assert_same_type(...)

Arguments

...

Arguments to be checked

Value

The function throws an error if not all arguments are of the same type.

Examples

example_fun <- function(true_value, false_value, missing_value) {
  assert_same_type(true_value, false_value, missing_value)
}

example_fun(
  true_value = "Y",
  false_value = "N",
  missing_value = NA_character_
)

try(example_fun(
  true_value = 1,
  false_value = 0,
  missing_value = "missing"
))
#> Error in assert_same_type(true_value, false_value, missing_value) : 
#>   All arguments must be of the same type.
#> Argument: Type
#> --------------
#> true_value: double
#> false_value: double
#> missing_value: character