dec.date: Convert date to decimal year fraction.

View source: R/utils.R

dec.dateR Documentation

Convert date to decimal year fraction.

Description

Convert a character or date class to decimal, taking into account leap years.

Usage

dec.date(date)

Arguments

date

Either a Date class object or an unambiguous character string in the format "YYYY-MM-DD".

Details

This makes use of the lubridate::decimal_date to compute the proportion of the year that has passed. If the date is numeric, it is returned as such. If it is "character", we try to coerce to date through lubridate::ymd, ergo, it is best to specify a character string in an unambiguous "YYYY-MM-DD" format. If date is given in a "Date" class it is dealt with accordingly.

Value

Numeric expression of the date, year plus the fraction of the year passed as of the date.


timriffe/DemoTools documentation built on Oct. 14, 2024, 12:53 p.m.