check_numeric_or_integer_type {vvauditor}R Documentation

Check for Numeric or Integer Type

Description

This function checks if the specified column in the provided dataframe has a numeric or integer type. It uses the checkmate::assert_numeric or checkmate::assert_integer function to perform the assertion, depending on the value of the field_type parameter.

Usage

check_numeric_or_integer_type(
  column_name,
  dataframe,
  column_prefix = NULL,
  field_type = "numeric",
  ...
)

Arguments

column_name

A character vector or string with the column name to be tested.

dataframe

The dataframe that contains the column.

column_prefix

Default is NULL. If provided, this text is prepended to the variable name in the assertion message.

field_type

Default is "numeric". Specify "integer" to check if the column has an integer type. This parameter must be either "integer" or "numeric".

...

The remaining parameters are passed to the function assert_numeric or assert_integer.

See Also

Other assertions: check_no_duplicates_in_group(), check_posixct_type()

Other tests: check_double_columns(), check_no_duplicates_in_group(), check_posixct_type(), duplicates_in_column(), test_all_equal()

Examples

# Create a dataframe with a numeric column
dataframe <- data.frame(a = c(1, 2, 3))
# Check the numeric type of the 'a' column
check_numeric_or_integer_type("a", dataframe)

[Package vvauditor version 0.6.0 Index]