enforce_types: Enforce variable types in a *c14_date_list*

View source: R/c14_date_list_enforce_types.R

enforce_typesR Documentation

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)

## 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

# 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)


nevrome/c14databases documentation built on Feb. 2, 2024, 2 a.m.