View source: R/util_check_data_type.R
util_check_data_type | R Documentation |
Function to verify the data type of a value.
util_check_data_type(
x,
type,
check_convertible = FALSE,
threshold_value = 0,
return_percentages = FALSE,
check_conversion_stable = FALSE,
robust_na = FALSE
)
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 |
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)
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.