enforce_types: Enforce variable types in a *c14_date_list*

Description Usage Arguments Value Examples

View source: R/c14_date_list_enforce_types.R

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

1
2
3
4
5
6
7
enforce_types(x, suppress_na_introduced_warnings = TRUE)

## Default S3 method:
enforce_types(x, suppress_na_introduced_warnings = TRUE)

## S3 method for class '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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 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)

c14bazAAR documentation built on March 26, 2020, 6:38 p.m.