util_check_data_type: Verify the data type of a value

View source: R/util_check_data_type.R

util_check_data_typeR Documentation

Verify the data type of a value

Description

Function to verify the data type of a value.

Usage

util_check_data_type(
  x,
  type,
  check_convertible = FALSE,
  threshold_value = 0,
  return_percentages = FALSE,
  check_conversion_stable = FALSE,
  robust_na = FALSE
)

Arguments

x

the value

type

expected data type

check_convertible

logical also try, if a conversion to the declared data type would work.

threshold_value

numeric from=0 to=100. percentage of failing conversions allowed.

return_percentages

logical return the percentage of mismatches.

check_conversion_stable

logical do not distinguish convertible from convertible, but with issues

robust_na

logical treat white-space-only-values as NA

Value

if return_percentages: if not check_convertible, the percentage of mismatches instead of logical value, if check_convertible, return a named vector with the percentages of all cases (names of the vector are match, convertible_mismatch_stable, convertible_mismatch_unstable, nonconvertible_mismatch) if not return_percentages: if check_convertible is FALSE, logical whether x is of the expected type if check_convertible is TRUE integer with the states ⁠0, 1, 2, 3⁠: 0 = Mismatch, not convertible 1 = Match 2 = Mismatch, but convertible 3 = Mismatch, convertible, but with issues (e.g., loss of decimal places)

See Also

Other data_management: util_assign_levlabs(), util_check_group_levels(), util_compare_meta_with_study(), util_dichotomize(), util_merge_data_frame_list(), util_rbind(), util_remove_na_records(), util_replace_hard_limit_violations(), util_study_var2factor(), util_table_of_vct()


dataquieR documentation built on May 29, 2024, 7:18 a.m.