date2day: Convert date-time data to numeric data in decimal days

View source: R/date2day.R

date2dayR Documentation

Convert date-time data to numeric data in decimal days

Description

A function to convert date-time data to decimal days with respect to a date-time origin.

Usage

  date2day(dates, start=NULL, tz="", ...)

Arguments

dates

A date-time or date object. Typically, it is a character vector containing date-time information.

start

A date-time or date object. Determines the origin of the conversion.

tz

Optional. Timezone specification to be used for the conversion.

...

Arguments to be passed to as.POSIXlt.

Details

The arguments dates and start must be of appropriate format to be passed to as.POSIXlt function.

Value

A numeric vector of the same length as dates.

Author(s)

Abdollah Jalilian jalilian@razi.ac.ir

See Also

as.POSIXlt and difftime for appropriate format of the data to be converted.

Examples

  # date-time data of Iran's earthquakes between 1973/01/01 and 2016/01/01
  dt <- paste(iran.quakes$date, iran.quakes$time)
  # origin of the conversion
  start <- "1973/01/01 00:00:00"
  # time in days since 1973-01-01 (UTC)
  date2day(dt, start, tz="GMT")

ETAS documentation built on Sept. 30, 2024, 9:42 a.m.