Learn R Programming

c14bazAAR (version 1.2.0)

enforce_types: Enforce variable types in a c14_date_list

Description

Enforce variable types in a c14_date_list and remove everything that doesn't fit (e.g. text in a number field). See the variable_reference table for a documentation of the variable types. enforce_types() is called in c14bazAAR::as.c14_date_list().

Usage

enforce_types(x, suppress_na_introduced_warnings = TRUE)

# S3 method for default enforce_types(x, suppress_na_introduced_warnings = TRUE)

# S3 method for c14_date_list enforce_types(x, suppress_na_introduced_warnings = TRUE)

Arguments

x

an object of class c14_date_list

suppress_na_introduced_warnings

suppress warnings caused by data removal in type transformation due to wrong database entries (such as text in a number column)

Value

an object of class c14_date_list

Examples

Run this code
# NOT RUN {
# initial situation
ex <- example_c14_date_list
class(ex$c14age)

# modify variable/column type
ex$c14age <- as.character(ex$c14age)
class(ex$c14age)

# fix type with enforce_types()
ex <- enforce_types(ex)
class(ex$c14age)

# }

Run the code above in your browser using DataLab