decimal_anydate: Converts a date of multiple formats to decimal

View source: R/reverse_survival_aux.R

decimal_anydateR Documentation

Converts a date of multiple formats to decimal

Description

Converts a date of multiple formats (year, year-month, year-month-day) to decimal

Usage

decimal_anydate(date)

Arguments

date

date in the format Y-m-d or string in the formats Y, Y-m, Y-m-d

Value

decimal of date's year

Examples

date1 <- '2011'
# converts date1 for decimal value of '2011-07-31'
decimal_anydate(date1)

date2 <- '2009-05'
# converts date2 for decimal value of '2009-05-15'
decimal_anydate(date2)

date3 <- '2013-10-31'
# converts date3 for decimal value of '2013-10-31'
decimal_anydate(date3)

josehcms/fertestr documentation built on Oct. 9, 2024, 9:03 p.m.