dectime function

Decimal Time

Decimal Time

Convert date/time data to be expressed as year and fractional part of year. This can be useful for plotting or representing time in a regression model.

dectime( dates, times, time.format, date.format, Date.noon = TRUE, year.type = c("calendar", "water", "climate") )

Arguments

  • dates: a vector of a valid date object, or character representation of dates. Missing values are permitted and produce corresponding missing values in the output.
  • times: a character representation of times. Missing values are permitted and produce corresponding missing values in the output.
  • time.format: format to convert times. See Details .
  • date.format: format to convert dates is character.
  • Date.noon: logical, if TRUE and dates is class "Date," then set set the time to noon, otherwise no time adjustment is made. See Details .
  • year.type: a character string indicating the type of year to determine the offset, must be one of "calendar," "water," or "climate."

Returns

A vector representation of the data in decimal format--year and decimal fraction.

Details

The format for times must be one of "hm," "hms," or "ms." Note that this is actually a conversion function, see See Also . If times

is missing, dates is class "Date," and Date.noon is TRUE, then set the time to 12:00, so that the decimal time represents the center of the day.

Added from smwrBase.

Examples

dectime("11/11/1918", date.format="%m/%d/%Y") dectime(1988:1990)