Last data update: 2014.03.03

R: Compile the date of measurement
gendateR Documentation

Compile the date of measurement

Description

Function gendate compiles different types of calendar dates and returns vector of class "Date". gendate recognizes single argument x as a vector of class "character", "Date", "POSIXct" or "POSIXlt".

Usage

gendate(x)

Arguments

x

vector of calendar dates of class "character", "Date", "POSIXct" or "POSIXlt".

Details

The gendate function rounds different types of date to single days. If more precise time point is specified by "POSIXct" or "POSIXlt" class, only the information about the day is used. In the case of character input, two formats are recognized: "2013-05-30" and "30.05.2013" also in shortened variant "2013-5-30" and "30.5.2013". Only the first 10 characters are used in both cases. If only the month (as "2013-05" or "5.2013") or the year (as "2013") is specified by the character string, the date is placed into the 15th day in the case of month or into a 1st July in the case of year.

Value

res

vector of dates of class "Date".

Author(s)

Jiri Kalina
kalina@mail.muni.cz

Examples

## Single dates:
gendate(Sys.Date())
gendate("10.6.1993")
gendate("1856")

## Date vectors:
gendate(c("2000-05-30","2001","4.4.98","2003-06-01 12:30:45"))
gendate(c(as.POSIXlt("2003-06-01 12:30:45"),"2003-07-02"))

Results