TimeDateCoercion {fCalendar}R Documentation

timeDate Class, Coercion and Transformation

Description

A collection and description of functions and methods for coercion and transformation of objects of class 'timeDate'.

The functions are:

as.timeDate.POSIXt Returns a 'POSIX' object as 'timeDate' object,
as.timeDate.Date Returns a 'POSIX' object as 'timeDate' object,
as.character.timeDate Returns a 'timeDate' object as character string,
as.data.frame.timeDate Returns a 'timeDate' object as data frame,
as.POSIXct.timeDate Returns a 'timeDate' object as POSIXct object,
julian.timeDate Returns Julian day counts since 1970-01-01,
atoms.timeDate Returns date/time atoms from a 'timeDate' object,
months.timeDate Extract months atom from a 'timeDate' object.

Usage

## Default S3 method:
as.timeDate(x, zone = myFinCenter, FinCenter = myFinCenter)
## S3 method for class 'POSIXt':
as.timeDate(x, zone = myFinCenter, FinCenter = myFinCenter)
## S3 method for class 'Date':
as.timeDate(x, zone = myFinCenter, FinCenter = myFinCenter) 

## S3 method for class 'timeDate':
as.character(x, ...)
## S3 method for class 'timeDate':
as.double(x, units = c("auto", "secs", "mins", "hours", "days", "weeks"), ...)
## S3 method for class 'timeDate':
as.data.frame(x, ...)
## S3 method for class 'timeDate':
as.POSIXct(x, tz = "")
## S3 method for class 'timeDate':
as.POSIXlt(x, tz = "")
## S3 method for class 'timeDate':
as.Date(x, method = c("trunc", "round", "next"), ...)

## S3 method for class 'timeDate':
julian(x, origin = timeDate("1970-01-01"), units = c("auto", 
    "secs", "mins", "hours", "days", "weeks"), zone = NULL, FinCenter = NULL, ...)
## S3 method for class 'timeDate':
atoms(x, ...)
## S3 method for class 'timeDate':
months(x, abbreviate = NULL)

Arguments

abbreviate [months] -
currently not used.
tz inputs the time zone to POSIX objects, i.e. the time zone, zone, or financial center string, FinCenter, as used by timeDate objects.
FinCenter a character with the the location of the financial center named as "continent/city".
method a character string denoting the method how to determine the dates.
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.
x an object of class timeDate.
zone the time zone or financial center where the data were recorded.
... arguments passed to other methods.

Value

as.character
as.data.frame
return a timeDate object trnasformed into a character or a data frame formatted object.

as.POSIXct
return a timeDate object transformed into a POSIX type formatted object.

julian
return a timeDate object as a Julian count.

atoms
months
extrac from a timeDate object the calendar atoms, i.e, the year, month, day, and optionally hour, minute and second.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

See Also

timeDateClass

Examples

## SOURCE("fCalendar.3E-TimeDateCoercion")

## as.character 
   tD = timeDate()
   as.character(tD)
   
## as.data.frame -
   as.data.frame(tD)
   
## as.POSIXct -  
   as.POSIXct(tD)

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

[Package fCalendar version 240.10068 Index]