trim_dates {sdtmval} | R Documentation |
Trim unknown elements in partial dates
Description
Removes unknown elements from a partial date. For example, "2017-UN-UN"
is trimmed to "2017"
and "2017-05-UN"
is trimmed to "2017-05"
.
Values of "UNKN-UN-UN"
are converted to NA
. Values where only
the year and day are known are converted to just the year, ie "2017-UN-01"
converts to "2017"
. Full dates are not modified.
Usage
trim_dates(dates, input_sep = "-")
Arguments
dates |
a character vector of partial dates in the format |
input_sep |
the character that separates date components in the input
vector |
Value
a character vector of trimmed partial dates and full dates
See Also
reshape_adates()
, reshape_pdates()
, impute_pdates()
,
vignette("Dates")
Examples
dates <- c(
"UNKN-UN-UN",
"2017-UN-UN",
"2017-02-UN",
"2017-UN-05",
"2017-09-03",
"UNKN-07-14",
NA
)
trim_dates(dates)
[Package sdtmval version 0.4.1 Index]