naaccr_datetime: Parse NAACCR-formatted datetimes

View source: R/data-item-interpreting.R

naaccr_datetimeR Documentation

Parse NAACCR-formatted datetimes

Description

Parse NAACCR-formatted datetimes

Usage

naaccr_datetime(datetime, tz = "")

Arguments

datetime

Character vector of datetimes in HL7 OBR-7 format ("YYYYMMDDHHMMSS") or the ISO 8601 format for datetimes accurate to the second (YYYY-MM-DDThh:mm:ss+zz:zz). Values containing a hyphen ("-") will be assumed to follow ISO 8601, and other values will be assumed to follow HL7 OBR-7.

tz

time zone specification to be used for the conversion, if one is required. System-specific (see time zones), but "" is the current time zone, and "GMT" is UTC (Universal Time, Coordinated). Invalid values are most commonly treated as UTC, on some platforms with a warning.

Value

A POSIXct vector. Any incomplete or invalid datetimes are converted to NA. The original strings can be retrieved with the naaccr_encode function.

Examples

  input <- c("20151031100856", "20140822    ", "99999999")
  d <- naaccr_datetime(input)
  d
  naaccr_encode(d, "pathDateSpecCollect1")

naaccr documentation built on Sept. 20, 2024, 5:07 p.m.