calendar-julian: Julian counts and calendar atoms

julianR Documentation

Julian counts and calendar atoms

Description

Returns Julian day counts, date/time atoms from a "timeDate" object, and extracts month atoms from a "timeDate" object.

Usage

## S4 method for signature 'timeDate'
julian(x, origin = timeDate("1970-01-01"), 
    units = c("auto", "secs", "mins", "hours", "days", "weeks"), 
    zone = NULL, FinCenter = NULL, ...)

## S4 method for signature 'timeDate'
atoms(x, ...)

## S4 method for signature 'timeDate'
months(x, abbreviate = NULL)

Arguments

x

an object of class "timeDate".

origin

a length-one object inheriting from class "timeDate" setting the origin for the julian counter.

units

a character string denoting the date/time units in which the results are desired.

zone

the time zone or financial center where the data were recorded.

FinCenter

a character string with the location of the financial center named as "continent/city".

abbreviate

currently not used.

...

arguments passed to other methods.

Details

Generic functions to extract properties of "timeDate" objects. julian and months are generics from base R, while atoms is a generic defined in this package.

julian extracts the number of days since origin (can be fractional), see also julian.

atoms extracts the calendar atoms from a "timeDate" object, i.e., the year, month, day, and optionally, hour, minute and second. The result is a data frame with the financial center in atrribute "control".

months extracts the months as integers from 1 to 12, unlike base::months which returns the names of the months.

Value

for julian, a difftime object;

for atoms, a data.frame with attribute "control" containing the financial center of the input vector x. The data frame has the following components:

Y

year,

m

month,

d

day,

H

hour,

M

minute,

S

scond;

for months, a numeric vector with attribute "control" containing the financial center.

See Also

the base R functions julian, difftime, months;

dayOfWeek, dayOfYear

Examples

## julian -
   tC = timeCalendar(2022)
   julian(tC)[1:3]
   
## atoms -
   atoms(tC)
   
## months -
   months(tC)

timeDate documentation built on Jan. 7, 2023, 5:30 p.m.