as.Dates: Converting potential date to Date vector

Description Usage Arguments Details Value Possible date range See Also Examples

View source: R/as.Dates.R

Description

The function recognizes dates in formats used by INCA and Rockan.

Usage

1

Arguments

x

atomic vector

Details

Regular expressions are used to match any of the following date formats:

All dates are coerced to Y-m-d (ISO 8601):

An alternative would be to use random assignments of dates within specified periods. This would have some benefits but does not conform to behavior used elsewhere by INCA.

Value

vector of class "Date"

Possible date range

All potential dates are accepted as such. RCC data should however only contain historic data. Dates from the future does therefore raise warnings. The same is true for dates before 1830. The Swedish cancer register was initiated in 1958. The earliest possible dates found in the register should therefore originate from birth date of really old people diagnosed with cancer during that year.

See Also

as.Date

Examples

1
2
3
4
5
6
7
8
9
as.Dates(c(1212121212, "20000101", "2014-10-15", 5806))

## Not run: 
# Note that the as.Date (as oppose to as.Dates)
# does not handle missing dates as empty strings
as.Date(c("", "2017-02-16")) # Error
as.Dates(c("", "2017-02-16")) # NA "2017-02-16"

## End(Not run)

incadata documentation built on April 14, 2020, 6:08 p.m.