check_numeric_or_integer_type.Rd
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.
check_numeric_or_integer_type(
column_name,
dataframe,
column_prefix = NULL,
field_type = "numeric",
...
)
A character vector or string with the column name to be tested.
The dataframe that contains the column.
Default is NULL. If provided, this text is prepended to the variable name in the assertion message.
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.
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()
# 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)