From 3fca4a53059377b1e62c9be963b01b0098a12603 Mon Sep 17 00:00:00 2001 From: elimillera Date: Thu, 15 Jun 2023 17:33:41 +0000 Subject: [PATCH] Push up extra type docs --- R/type.R | 12 +++++++++++- man/xportr_type.Rd | 13 ++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/R/type.R b/R/type.R index 605e7868..0114309c 100644 --- a/R/type.R +++ b/R/type.R @@ -5,7 +5,17 @@ #' 'xportr.character_types' option is used to explicitly collapse the class of a #' column to character using `as.character`. Similarly, 'xportr.numeric_types' #' will collapse a column to a numeric type. If no type is passed for a -#' variable, it is assumed to be numeric and coerced with `as.numeric`. +#' variable and it isn't identifed as a timing variable, it is assumed to be numeric and coerced with `as.numeric`. +#' +#' Certain care should be taken when using timing variables. R serializes dates +#' based on a reference date of 01/01/1970 where XPT uses 01/01/1960. This can +#' result in dates being 10 years off when outputting from R to XPT if you're +#' using a date class. For this reason, `xportr` will try to determine what +#' should happen with variables that appear to be used to denote time. +#' +#' For variables that end in DT, DTM, or, TM, if they are not explicitly noted +#' in 'xportr.numeric_types' or 'xportr.character_types', they are coerced to +#' numeric results. #' #' @inheritParams xportr_length #' diff --git a/man/xportr_type.Rd b/man/xportr_type.Rd index c0380401..abfa41d8 100644 --- a/man/xportr_type.Rd +++ b/man/xportr_type.Rd @@ -38,7 +38,18 @@ attempts to collapse R classes to those two XPT types. The 'xportr.character_types' option is used to explicitly collapse the class of a column to character using \code{as.character}. Similarly, 'xportr.numeric_types' will collapse a column to a numeric type. If no type is passed for a -variable, it is assumed to be numeric and coerced with \code{as.numeric}. +variable and it isn't identifed as a timing variable, it is assumed to be numeric and coerced with \code{as.numeric}. +} +\details{ +Certain care should be taken when using timing variables. R serializes dates +based on a reference date of 01/01/1970 where XPT uses 01/01/1960. This can +result in dates being 10 years off when outputting from R to XPT if you're +using a date class. For this reason, \code{xportr} will try to determine what +should happen with variables that appear to be used to denote time. + +For variables that end in DT, DTM, or, TM, if they are not explicitly noted +in 'xportr.numeric_types' or 'xportr.character_types', they are coerced to +numeric results. } \section{Messaging}{ \code{type_log()} is the primary messaging tool for