Convert between Julian and Calendar Dates

DESCRIPTION:
Convert between Julian and Calendar Dates

USAGE:
julian(m, d, y, origin=c(month=1, day=1, year=1960))
month.day.year(jul, origin=c(month=1, day=1, year=1960))
leap.year(y)
day.of.week(m, d, y)

REQUIRED ARGUMENTS:
m:
vector of month numbers.
d:
vector of day numbers.
y:
vector of years.
jul:
vector of Julian Dates, i.e., number of days since origin.

OPTIONAL ARGUMENTS:
origin:
vector specifying the origin as month, day, and year. If missing, it defaults to options(chron.origin) if this is non-null, otherwise c(month=1, day=1, year=1960).

VALUE:
A vector of Julian dates (number of days since origin) when julian() is called, or a list with members month, day, year corresponding to the input Julian dates if month.day.year() is called. leap.year() returns a logical vector indicating whether the corresponding year is a leap year. day.of.week() returns a number between 0 and 6 to specify day of the week--0 refers to Sunday.

These functions were taken from Becker, Chambers, and Wilks (1988), and were slightly modified to take dates objects; some also take the extra argument origin. The original functions are stored in the library(example).


SEE ALSO:
dates , months .

EXAMPLES:
n.days <- julian(mon, day, 1990+yr, origin=c(1,1,1990))