Rmetrics - Chronological and Calendarical Objects

Rmetrics - Chronological and Calendarical Objects [R logo]

Help pages for package `fCalendar' version 240.10068

A B C D E F G H I J K L M N O P Q R S T U V W Y Z misc

+.timeDate | timeDate Class, Functions and Methods
-.timeDate | timeDate Class, Functions and Methods

-- A --

abs.timeSeries | timeSeries Class, Functions and Methods
Adelaide | Daylight Saving Time Rules
Advent1st | Public and Ecclesiastical Holidays
Advent2nd | Public and Ecclesiastical Holidays
Advent3rd | Public and Ecclesiastical Holidays
Advent4th | Public and Ecclesiastical Holidays
Algiers | Daylight Saving Time Rules
align | Some Rmetrics Utilities
alignDailySeries | timeSeries Class
AllSaints | Public and Ecclesiastical Holidays
AllSouls | Public and Ecclesiastical Holidays
Amsterdam | Daylight Saving Time Rules
Anchorage | Daylight Saving Time Rules
Andorra | Daylight Saving Time Rules
Annunciation | Public and Ecclesiastical Holidays
applySeries | timeSeries Class
as.character.timeDate | timeDate Class, Coercion and Transformation
as.data.frame.timeDate | timeDate Class, Coercion and Transformation
as.data.frame.timeSeries | timeSeries Class, Coercion and Transformation
as.Date.timeDate | timeDate Class, Coercion and Transformation
as.double.timeDate | timeDate Class, Coercion and Transformation
as.matrix.mts | Some Rmetrics Utilities
as.matrix.timeSeries | timeSeries Class, Coercion and Transformation
as.matrix.ts | Some Rmetrics Utilities
as.POSIXct.timeDate | timeDate Class, Coercion and Transformation
as.POSIXlt | Some Rmetrics Utilities
as.POSIXlt.timeDate | timeDate Class, Coercion and Transformation
as.timeDate | timeDate Class, Coercion and Transformation
as.timeSeries | timeSeries Class, Coercion and Transformation
as.ts.timeSeries | timeSeries Class, Coercion and Transformation
as.vector.timeSeries | timeSeries Class, Coercion and Transformation
Ascension | Public and Ecclesiastical Holidays
AshWednesday | Public and Ecclesiastical Holidays
AssumptionOfMary | Public and Ecclesiastical Holidays
Athens | Daylight Saving Time Rules
atoms | Some Rmetrics Utilities
atoms.timeDate | timeDate Class, Coercion and Transformation
Auckland | Daylight Saving Time Rules

-- B --

Bahrain | Daylight Saving Time Rules
Bangkok | Daylight Saving Time Rules
Beirut | Daylight Saving Time Rules
Belfast | Daylight Saving Time Rules
Belgrade | Daylight Saving Time Rules
Berlin | Daylight Saving Time Rules
BirthOfVirginMary | Public and Ecclesiastical Holidays
blockEnd | timeDate Class, Subsetting
blockStart | timeDate Class, Subsetting
Bogota | Daylight Saving Time Rules
BoxingDay | Public and Ecclesiastical Holidays
Bratislava | Daylight Saving Time Rules
Brisbane | Daylight Saving Time Rules
Brussels | Daylight Saving Time Rules
Bucharest | Daylight Saving Time Rules
Budapest | Daylight Saving Time Rules
BuenosAires | Daylight Saving Time Rules

-- C --

c.timeDate | timeDate Class, Functions and Methods
CACanadaDay | Public and Ecclesiastical Holidays
CACivicProvincialHoliday | Public and Ecclesiastical Holidays
Cairo | Daylight Saving Time Rules
CALabourDay | Public and Ecclesiastical Holidays
Calcutta | Daylight Saving Time Rules
Caracas | Daylight Saving Time Rules
CaRemembranceDay | Public and Ecclesiastical Holidays
Casablanca | Daylight Saving Time Rules
CAThanksgivingDay | Public and Ecclesiastical Holidays
CAVictoriaDay | Public and Ecclesiastical Holidays
Cayman | Daylight Saving Time Rules
CelebrationOfHolyCross | Public and Ecclesiastical Holidays
CHAscension | Public and Ecclesiastical Holidays
CHBerchtoldsDay | Public and Ecclesiastical Holidays
CHConfederationDay | Public and Ecclesiastical Holidays
Chicago | Daylight Saving Time Rules
CHKnabenschiessen | Public and Ecclesiastical Holidays
ChristmasDay | Public and Ecclesiastical Holidays
ChristmasEve | Public and Ecclesiastical Holidays
ChristTheKing | Public and Ecclesiastical Holidays
CHSechselaeuten | Public and Ecclesiastical Holidays
Copenhagen | Daylight Saving Time Rules
CorpusChristi | Public and Ecclesiastical Holidays
cumsum.timeSeries | timeSeries Class, Functions and Methods
currentYear | Some Rmetrics Utilities
cut.timeDate | timeDate Class, Subsetting
cut.timeSeries | timeSeries Class, Functions and Methods

-- D --

Darwin | Daylight Saving Time Rules
DaylightSavingTime | Daylight Saving Time Rules
DEAscension | Public and Ecclesiastical Holidays
DEChristmasEve | Public and Ecclesiastical Holidays
DECorpusChristi | Public and Ecclesiastical Holidays
DEGermanUnity | Public and Ecclesiastical Holidays
DENewYearsEve | Public and Ecclesiastical Holidays
Denver | Daylight Saving Time Rules
Detroit | Daylight Saving Time Rules
diff.timeDate | timeDate Class, Functions and Methods
diff.timeSeries | timeSeries Class, Functions and Methods
difftimeDate | timeDate Class, Functions and Methods
dim.timeSeries | timeSeries Class, Functions and Methods
dimnames.timeSeries | timeSeries Class, Functions and Methods
Dubai | Daylight Saving Time Rules
Dublin | Daylight Saving Time Rules
dummyDailySeries | timeSeries Class
durationSeries | timeSeries Class

-- E --

Easter | Public and Ecclesiastical Holidays
EasterMonday | Public and Ecclesiastical Holidays
Eastern | Daylight Saving Time Rules
EasterSunday | Public and Ecclesiastical Holidays
economagicImport | Import Market Data from the Internet
Edmonton | Daylight Saving Time Rules
end.timeDate | timeDate Class, Subsetting
end.timeSeries | timeSeries, Positions
Epiphany | Public and Ecclesiastical Holidays
exp.timeSeries | timeSeries Class, Functions and Methods

-- F --

forecastsImport | Import Market Data from the Internet
format.timeDate | timeDate Class
FRAllSaints | Public and Ecclesiastical Holidays
Frankfurt | Daylight Saving Time Rules
FRArmisticeDay | Public and Ecclesiastical Holidays
FRAscension | Public and Ecclesiastical Holidays
FRAssumptionVirginMary | Public and Ecclesiastical Holidays
FRBastilleDay | Public and Ecclesiastical Holidays
fredImport | Import Market Data from the Internet
FRFetDeLaVictoire1945 | Public and Ecclesiastical Holidays
fWEBDATA | Import Market Data from the Internet
fWEBDATA-class | Import Market Data from the Internet

-- G --

GBBankHoliday | Public and Ecclesiastical Holidays
GBMayDay | Public and Ecclesiastical Holidays
GBMilleniumDay | Public and Ecclesiastical Holidays
GBSummerBankHoliday | Public and Ecclesiastical Holidays
getDayOfWeek | timeDate Class, Subsetting
getDayOfYear | timeDate Class, Subsetting
GoodFriday | Public and Ecclesiastical Holidays

-- H --

head.timeSeries | timeSeries Class, Functions and Methods
Helsinki | Daylight Saving Time Rules
holiday | Holiday Calendars and Utilities
HolidayCalendars | Holiday Calendars and Utilities
HolidayDates | Public and Ecclesiastical Holidays
holidayNYSE | Holiday Calendars and Utilities
holidayZURICH | Holiday Calendars and Utilities
HongKong | Daylight Saving Time Rules
Honolulu | Daylight Saving Time Rules

-- I --

Indianapolis | Daylight Saving Time Rules
is.array.timeSeries | timeSeries Class, Functions and Methods
is.timeDate | timeDate Class
is.timeSeries | timeSeries Class, Coercion and Transformation
isBizday | timeDate Class, Subsetting
isHoliday | timeDate Class, Subsetting
isMultivariate | timeSeries Class
Istanbul | Daylight Saving Time Rules
isUnivariate | timeSeries Class
isWeekday | timeDate Class, Subsetting
isWeekend | timeDate Class, Subsetting
ITAllSaints | Public and Ecclesiastical Holidays
ITAssumptionOfVirginMary | Public and Ecclesiastical Holidays
ITEpiphany | Public and Ecclesiastical Holidays
ITImmaculateConception | Public and Ecclesiastical Holidays
ITLiberationDay | Public and Ecclesiastical Holidays
ITStAmrose | Public and Ecclesiastical Holidays

-- J --

Jakarta | Daylight Saving Time Rules
Jerusalem | Daylight Saving Time Rules
Johannesburg | Daylight Saving Time Rules
JPAutumnalEquinox | Public and Ecclesiastical Holidays
JPBankHolidayDec31 | Public and Ecclesiastical Holidays
JPBankHolidayJan2 | Public and Ecclesiastical Holidays
JPBankHolidayJan3 | Public and Ecclesiastical Holidays
JPBunkaNoHi | Public and Ecclesiastical Holidays
JPChildrensDay | Public and Ecclesiastical Holidays
JPComingOfAgeDay | Public and Ecclesiastical Holidays
JPConstitutionDay | Public and Ecclesiastical Holidays
JPEmperorsBirthday | Public and Ecclesiastical Holidays
JPGantan | Public and Ecclesiastical Holidays
JPGreeneryDay | Public and Ecclesiastical Holidays
JPHealthandSportsDay | Public and Ecclesiastical Holidays
JPKeirouNOhi | Public and Ecclesiastical Holidays
JPKenkokuKinenNoHi | Public and Ecclesiastical Holidays
JPKenpouKinenBi | Public and Ecclesiastical Holidays
JPKinrouKanshaNoHi | Public and Ecclesiastical Holidays
JPKodomoNoHi | Public and Ecclesiastical Holidays
JPKokuminNoKyujitu | Public and Ecclesiastical Holidays
JPMarineDay | Public and Ecclesiastical Holidays
JPMidoriNoHi | Public and Ecclesiastical Holidays
JPNatFoundationDay | Public and Ecclesiastical Holidays
JPNationalCultureDay | Public and Ecclesiastical Holidays
JPNationHoliday | Public and Ecclesiastical Holidays
JPNewYearsDay | Public and Ecclesiastical Holidays
JPRespectForTheAgedDay | Public and Ecclesiastical Holidays
JPSeijinNoHi | Public and Ecclesiastical Holidays
JPShuubunNoHi | Public and Ecclesiastical Holidays
JPTaiikuNoHi | Public and Ecclesiastical Holidays
JPTennouTanjyouBi | Public and Ecclesiastical Holidays
JPThanksgivingDay | Public and Ecclesiastical Holidays
JPUmiNoHi | Public and Ecclesiastical Holidays
julian.timeDate | timeDate Class, Coercion and Transformation

-- K --

keystatsImport | Import Market Data from the Internet
Kiev | Daylight Saving Time Rules
KualaLumpur | Daylight Saving Time Rules
Kuwait | Daylight Saving Time Rules

-- L --

LaborDay | Public and Ecclesiastical Holidays
lag.timeSeries | timeSeries Class, Functions and Methods
Lagos | Daylight Saving Time Rules
length.timeDate | timeDate Class, Subsetting
lines.timeDate | timeDate Class
lines.timeSeries | timeSeries Class
Lisbon | Daylight Saving Time Rules
listFinCenter | timeDate Class
Ljubljana | Daylight Saving Time Rules
log | Some Rmetrics Utilities
log.timeSeries | timeSeries Class, Functions and Methods
London | Daylight Saving Time Rules
LosAngeles | Daylight Saving Time Rules
Luxembourg | Daylight Saving Time Rules

-- M --

Madrid | Daylight Saving Time Rules
Manila | Daylight Saving Time Rules
MassOfArchangels | Public and Ecclesiastical Holidays
Melbourne | Daylight Saving Time Rules
merge.timeSeries | timeSeries Class, Functions and Methods
MexicoCity | Daylight Saving Time Rules
midquoteSeries | timeSeries Class
modify | Some Rmetrics Utilities
Monaco | Daylight Saving Time Rules
months.timeDate | timeDate Class, Coercion and Transformation
Montreal | Daylight Saving Time Rules
Moscow | Daylight Saving Time Rules
myFinCenter | timeDate Class
myUnits | Some Rmetrics Utilities

-- N --

Nairobi | Daylight Saving Time Rules
Nassau | Daylight Saving Time Rules
NewYearsDay | Public and Ecclesiastical Holidays
NewYork | Daylight Saving Time Rules
Nicosia | Daylight Saving Time Rules

-- O --

ohlcDailyPlot | timeSeries Class
Ops.timeDate | timeDate Class, Functions and Methods
Ops.timeSeries | timeSeries Class, Functions and Methods
orderStatistics | timeSeries Class
Oslo | Daylight Saving Time Rules
outlier | Some Rmetrics Utilities
outlier.timeSeries | timeSeries Class, Functions and Methods

-- P --

Pacific | Daylight Saving Time Rules
PalmSunday | Public and Ecclesiastical Holidays
Paris | Daylight Saving Time Rules
Pentecost | Public and Ecclesiastical Holidays
PentecostMonday | Public and Ecclesiastical Holidays
Perth | Daylight Saving Time Rules
plot.timeDate | timeDate Class
plot.timeSeries | timeSeries Class
points.timeDate | timeDate Class
points.timeSeries | timeSeries Class
Prague | Daylight Saving Time Rules
PresentationOfLord | Public and Ecclesiastical Holidays
print.keystats | Import Market Data from the Internet
print.timeDate | timeDate Class
print.timeSeries | timeSeries Class

-- Q --

quantile.timeSeries | timeSeries Class, Functions and Methods
Quinquagesima | Public and Ecclesiastical Holidays

-- R --

rbind.timeSeries | timeSeries Class, Functions and Methods
readSeries | timeSeries Class
rep.timeDate | timeDate Class, Functions and Methods
returnSeries | timeSeries Class
rev.timeDate | timeDate Class, Functions and Methods
rev.timeSeries | timeSeries, Positions
Riga | Daylight Saving Time Rules
Riyadh | Daylight Saving Time Rules
RmetricsUtilities | Some Rmetrics Utilities
RogationSunday | Public and Ecclesiastical Holidays
Rome | Daylight Saving Time Rules
round | Some Rmetrics Utilities
round.timeDate | timeDate Class, Functions and Methods
rulesFinCenter | timeDate Class

-- S --

sample | Some Rmetrics Utilities
sample.timeDate | timeDate Class, Functions and Methods
sample.timeSeries | timeSeries, Positions
scale.timeSeries | timeSeries Class, Functions and Methods
Seoul | Daylight Saving Time Rules
Septuagesima | Public and Ecclesiastical Holidays
seq.timeDate | timeDate Class
seriesData | timeSeries Class
seriesPositions | timeSeries, Positions
Shanghai | Daylight Saving Time Rules
show,fWEBDATA-method | Import Market Data from the Internet
show.fWEBDATA | Import Market Data from the Internet
sign.timeSeries | timeSeries Class, Functions and Methods
Singapore | Daylight Saving Time Rules
Sofia | Daylight Saving Time Rules
SolemnityOfMary | Public and Ecclesiastical Holidays
sort | Some Rmetrics Utilities
sort.timeDate | timeDate Class, Functions and Methods
sort.timeSeries | timeSeries, Positions
spreadSeries | timeSeries Class
sqrt.timeSeries | timeSeries Class, Functions and Methods
start.timeDate | timeDate Class, Subsetting
start.timeSeries | timeSeries, Positions
Stockholm | Daylight Saving Time Rules
summary.timeDate | timeDate Class
summary.timeSeries | timeSeries Class
Sydney | Daylight Saving Time Rules
Sys.timeDate | timeDate Class

-- T --

tail.timeSeries | timeSeries Class, Functions and Methods
Taipei | Daylight Saving Time Rules
Tallinn | Daylight Saving Time Rules
Tehran | Daylight Saving Time Rules
timeCalendar | timeDate Class
timeDate | timeDate Class
timeDate-class | timeDate Class
TimeDateClass | timeDate Class
TimeDateCoercion | timeDate Class, Coercion and Transformation
TimeDateMathOps | timeDate Class, Functions and Methods
TimeDateSpecDates | timeDate Class, Special Date Functions
TimeDateSubsets | timeDate Class, Subsetting
timeFirstDayInMonth | timeDate Class, Special Date Functions
timeFirstDayInQuarter | timeDate Class, Special Date Functions
timeLastDayInMonth | timeDate Class, Special Date Functions
timeLastDayInQuarter | timeDate Class, Special Date Functions
timeLastNdayInMonth | timeDate Class, Special Date Functions
timeNdayOnOrAfter | timeDate Class, Special Date Functions
timeNdayOnOrBefore | timeDate Class, Special Date Functions
timeNthNdayInMonth | timeDate Class, Special Date Functions
timeSequence | timeDate Class
timeSeries | timeSeries Class
timeSeries-class | timeSeries Class
TimeSeriesClass | timeSeries Class
TimeSeriesCoercion | timeSeries Class, Coercion and Transformation
TimeSeriesData | timeSeries Class, Functions and Methods
TimeSeriesImport | Import Market Data from the Internet
TimeSeriesPositions | timeSeries, Positions
Tokyo | Daylight Saving Time Rules
TransfigurationOfLord | Public and Ecclesiastical Holidays
TrinitySunday | Public and Ecclesiastical Holidays
trunc.timeDate | timeDate Class, Functions and Methods
Tunis | Daylight Saving Time Rules

-- U --

unique.timeDate | timeDate Class, Functions and Methods
USChristmasDay | Public and Ecclesiastical Holidays
USColumbusDay | Public and Ecclesiastical Holidays
USCPulaskisBirthday | Public and Ecclesiastical Holidays
USDecorationMemorialDay | Public and Ecclesiastical Holidays
USElectionDay | Public and Ecclesiastical Holidays
USGoodFriday | Public and Ecclesiastical Holidays
USInaugurationDay | Public and Ecclesiastical Holidays
USIndependenceDay | Public and Ecclesiastical Holidays
USLaborDay | Public and Ecclesiastical Holidays
USLincolnsBirthday | Public and Ecclesiastical Holidays
USMemorialDay | Public and Ecclesiastical Holidays
USMLKingsBirthday | Public and Ecclesiastical Holidays
USNewYearsDay | Public and Ecclesiastical Holidays
USPresidentsDay | Public and Ecclesiastical Holidays
USThanksgivingDay | Public and Ecclesiastical Holidays
USVeteransDay | Public and Ecclesiastical Holidays
USWashingtonsBirthday | Public and Ecclesiastical Holidays

-- V --

Vaduz | Daylight Saving Time Rules
Vancouver | Daylight Saving Time Rules
var | Some Rmetrics Utilities
var.timeSeries | timeSeries Class, Functions and Methods
Vienna | Daylight Saving Time Rules
Vilnius | Daylight Saving Time Rules

-- W --

Warsaw | Daylight Saving Time Rules
Winnipeg | Daylight Saving Time Rules

-- Y --

yahooImport | Import Market Data from the Internet
yahooSeries | Import Market Data from the Internet

-- Z --

Zagreb | Daylight Saving Time Rules
Zurich | Daylight Saving Time Rules

-- misc --

[.timeDate | timeDate Class, Subsetting
[.timeSeries | timeSeries Class, Functions and Methods


Some Rmetrics Utilities

Description

A collection and description of functions which mask function from R's base installation to generate generic functions and some additional generic functions which may be useful.

Usage

align.default(x, y, xout, method = "linear", n = 50, rule = 1, f = 0,
    ties = mean, ...)

log.default(x, base = exp(1))

outlier.default(x, sd = 5, complement = TRUE, ...)

round.default(x, digits, ...)

sample.default(x, size, replace = FALSE, prob = NULL, ...)

sort.default(x, partial = NULL, na.last = NA, decreasing = FALSE,
    method = c("shell", "quick"), index.return = FALSE, ...)

var.default(x, y = NULL, na.rm = FALSE, use)

rownames(x) <- value
colnames(x) <- value

as.POSIXlt(x, tz = "")

as.matrix.ts(x)
as.matrix.mts(x)

currentYear
myUnits

Arguments

base | [log] - additional argument to the log function.
digits | [round] - an integer indicating the precision to be used.
f | [align] - for method="constant" the value of f takes a number between 0 and 1 inclusive, indicating a compromise between left- and right-continuous step functions. If y0 and y1 are the values to the left and right of the point then the value is y0*(1-f)+y1*f so that f=0 is right-continuous and f=1 is left-continuous.
method | [align] - a character string which specifies the alignment method to be used. Choices are "linear" or "constant".
n | [align] - if xout is not specified, alignment takes place at n equally spaced points spanning the interval range(x).
partial, na.last, decreasing, index.return | [sort] - additional arguments to the sort function.
rule | [align] - an integer describing how alignment is to take place outside the interval range(x). If rule=1 then NA's are returned for such points and if is rule=2, the value at the closest data extreme is used.
sd, complement | [outlier] - sd - a numeric value of standard deviations, e.g. 5 means that values larger or smaller tahn five times the standard deviation of the series will detected. complement - a logical flag, should the outlier series or its complements be returned ?
size, replace, prob | [sample] - size - is a non-negative integer giving the number of items to choose, replace - a logical flag. Should sampling be with replacement? prob - a vector of probability weights for obtaining the elements of the vector being sampled.
ties | [align] - handles tied x values. Either a function with a single vector argument returning a single number result or the string "ordered".
tz | [as.POSIXlt] - time zone specification.
value | [colnames][rownames] - additional arguments to the colnames and rownames functions.
x | [align] - x-coordinates of the points to be aligned. [log][sort][var] - first argument. [as.matrix.ts][as.matrix.mts] - an univariate or multivariate time series object of class "ts" or "mts" which will be transformed into an one-column or multi-column rectangular object of class "matrix". [as.POSIXlt] - an object to be converted.
xout | [align] - a set of values specifying where interpolation is to take place.
y, na.rm, use | [align] - y-coordinates of the points to be aligned. [var] - additional arguments to the var function.
... | arguments to be passed.

Details

For details we refer to the original help pages.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

Examples

## SOURCE("fCalendar.1A-RmetricsUtilities")
[Package fCalendar version 240.10068 Index]


Daylight Saving Time Rules

Description

A collection and description of functions for 92 cities and regions, which return time zone offsets and daylight saving time rules.

The functions are:

Adelaide Algiers Amsterdam Anchorage Andorra Athens Auckland Bahrain Bangkok Beirut Belfast Belgrade Berlin Bogota Bratislava Brisbane Brussels Bucharest Budapest BuenosAires Cairo Calcutta Caracas Casablanca Cayman Chicago Copenhagen Darwin Denver Detroit Dubai Dublin Eastern Edmonton Frankfurt Helsinki HongKong Honolulu Indianapolis Istanbul Jakarta Jerusalem Johannesburg Kiev KualaLumpur Kuwait Lagos Lisbon Ljubljana London LosAngeles Luxembourg Madrid Manila Melbourne MexicoCity Monaco Montreal Moscow Nairobi Nassau NewYork Nicosia Oslo Pacific Paris Perth Prague Riga Riyadh Rome Seoul Shanghai Singapore Sofia Stockholm Sydney Taipei Tallinn Tehran Tokyo Tunis Vaduz Vancouver Vienna Vilnius Warsaw Winnipeg Zagreb Zurich.

Note

There are currently two synonymes available "Pacific" for Los Angeles and "Eastern" for New York.

Note that we leave the space in all double named cities like New York or Hong Kong and don't use an underscore for it.

All the entries are retrieved from the Ical library which is available under GNU's GPL licence.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

Examples

## SOURCE("fCalendar.2B-DaylightSavingTime")

## ...
   # DST Rules for Zurich:
   head(Zurich())
   tail(Zurich())


timeDate Class

Description

A collection and description of functions and methods for managing date and time around the globe for any financial center. The concept allows for dealing with several time zones at the same time, day light saving time and holiday calendars independently of the date and time specifications of the operating system implemented on a specific computer.

The functions for Financial Centers are:

rulesFinCenter | Returns DST rules for a financial center,
listFinCenter | Lists all supported financial centers.

The functions for the Generation of 'timeDate' objects are:

timeDate | S4: Creates 'timeDate' object from a character vector,
is.timeDate | Tests if the object is of class 'timeDate',
timeCalendar | Creates 'timeDate' object from calendar atoms,
timeSequence | Creates regularly spaced object of class 'timeDate',
seq | A synonyme function for timeSequence,
Sys.timeDate | Returns system time as an object of class 'timeDate'.

The functions to represent 'timeDate' objects:
print.timeDate | Prints 'timeDate' Object,
plot.timeDate | Plots with GMT 'timeDate' x-axis,
points.timeDate | Adds points to a 'timeDate' plot,
lines.timeDate | Adds lines to a 'timeDate' plot,
summary.timeDate | Summarizes details of a 'timeDate' object,
format.timeDate | Formats 'timeDate' as ISO conform character string,

Usage

myFinCenter
rulesFinCenter(FinCenter = myFinCenter)
listFinCenter(pattern = "*")

timeDate(charvec = Sys.timeDate(), format = NULL, zone = myFinCenter,
    FinCenter = myFinCenter)
timeCalendar(y = currentYear, m = 1:12, d = 1, h = NULL, min = NULL,
    s = NULL, zone = myFinCenter, FinCenter = myFinCenter)
timeSequence(from = "2004-01-01", to = format(Sys.time(), "%Y-%m-%d"),
    by = c("day", "year", "quarter", "month", "week", "hour", "min", "sec"),
    length.out = NULL, format = "", zone = myFinCenter, FinCenter = myFinCenter)
Sys.timeDate(FinCenter = myFinCenter)

## S3 method for class 'timeDate':
seq(from, to, by = c("day", "year", "quarter", "month",
    "week", "hour", "min", "sec"), length.out = NULL, ...)

is.timeDate(object)

## S3 method for class 'timeDate':
print(x, ...)
## S3 method for class 'timeDate':
plot(x, y, ...)
## S3 method for class 'timeDate':
summary(object, ...)
## S3 method for class 'timeDate':
format(x, ...)

currentYear
myUnits

Arguments

by | a character string, containing one of "sec", "min", "hour", "day", "week", "month" or "year". This can optionally be preceded by an integer and a space, or followed by "s".
charvec | a character vector of dates and times.
FinCenter | a character with the the location of the financial center named as "continent/city".
format | the format specification of the input character vector.
from, to | [timeSequence] - starting date, required, and end date, optional. If supplied to must be after from, [seq] - cr in this case the from and to dates must be objects of class timeDate.
h, min, s | hours of the days (0-23), defaults are 0, minutes of the days (0-59), defaults are 0, and seconds of the days (0-59), defaults are 0.
length.out | length.out integer, optional. Desired length of the sequence, if specified "to" will be ignored.
method | [modify] - a character string defining the modification method, one of "sort", "round", or "trunc".
object | [is.timeData][summary] - an object of class timeDate.
pattern | a pattern character string which can be recognized by the grep function. Wild cards are allowed.
x | [isWeekday][isWeekend][isBizday][weekDay] - an object of class timeDate. [format][print][plot] - an object of class timeDate.
y, m, d | [timeCalendar] - calendar years (e.g. 1997), defaults are 1960, calendar months (1-12), defaults are 1, and calendar days (1-31), defaults are 1, [plot] - a numeric vector.
zone | the time zone or financial center where the data were recorded.
... | arguments passed to other methods.

Details

For the management of chronological objects under R three concepts are available: The first is the implementation of date and time in R's chron package neglecting locals, time zones and day light saving times. This approach is appropriate for economic time series. The second approach, available in R's base package implements the POSIX standard to date and time objects, named "POSIXt". Unfortunately, the representation of these objects is operating system dependent and especially under MS Windows several problems appear in the management of time zones and day light saving times. Here we present a solution to overcome these difficulties with POSIX objects and introduce a new S4 class of 'timeDate' objects which allow for powerful methods to represent dates and times in different financial centers around the world. Many of the basic functionalities of these objects are in common with S-Plus' timeDate objects and thus many of your privately written functions for FinMetrics may also be used within R's environment.

A major difference is the time zone concept which is replaced by the "Financial Center" concept. The FinCenter character variable specifies where you are living and at which financial center you are working. With the variable myFinCenter you can overwrite the default setting with your personal settings. With the specification of the FinCenter your system knows what rules rules for day light saving times should be applied, what is your holiday calendar, what are your interest rate conventions. (Not all specifications are already implemented.) Many other aspects can be easily accessed when a financial center is named. So we can distinguish between Frankfurt and Zurich, which both belong to the same time zone, but differed in DST changes in the eighties and have different holiday calendars. Futhermore, since the underlying time refers to "GMT" and DST rules and all other information is available in local (ASCII) databases, we are sure, that R delivers with such a date/time concept on every computer independent of the operating system in use, identical results.

Another important feature of the "timeDate" concept used here is the fact that we don't rely on American or European ways to write dates. We use consequently the ISO-8601 standard for date and time notations.

Financial Centers

There are two functions concerned with the financial centers. The first, rulesFinCenter, lists the daylight saving rules for a selected financial center, and the second, listFinCenter, lists all centers available in the database. There is no dependency on the POSIX implementation of your operating system because all time zone and day light saving time information is stored locally in ASCII files. It is important to say, that the TZ environment variable must set to "GMT" in your system environment that there are no conflicts with the POSIX time zone management.

Through the definition of financial centers it becomes possible to introduce in the future a specification structure for financial centers, which includes further information for a center like holiday calendars, currency and interest rate conventions or many others.

Generation of timeDate Objects

We have defined a 'timeDate' class which is in many aspects similar to the S-Plus class with the same name, but has also some important advantageous differeneces. The S4 class has four Slots, the Data slot which holds date and time as 'POSIXlt' objects in the standard ISO-8601 format, the Dim slot which gives the dimension of the data object, the format specification slot and the FinCenter slot which holds the name of the financial center.

Three functions allow to cgenerate date/time objects: timeDate from character vectors, timeCalendar from date and time atoms, and timeSequence from a "from/to" or from a "from/length" sequence specification. Note, time zone transformations are easily handled by by the timeDate functions which can also take timeDate and POSIXt objects as inputs, while transforming them between financial centers and/or time zones specified by the arguments zone and FinCenter. Finally the function Sys.timeDate returns current system time in form of a timeDate object.

Tests and Representation of timeDate Objects:

We have implemented four methods to test and represent timeDate objects. The method is.timeDate checks if a given object is of class "timeDate". The print method returns the date/time in square "[]" brackets to dsitinguish the output from other date and time objects. On top of the date and time output the name of the FinCenter is printed. The summary method returns a printed report with information about the "timeDate" object. Finally, the format methods allows to transform objects into a ISO conform formatted character strings.

Mathematical Operations:

This is a collection of S3 methods for objects of class timeDate to perform mathematical operations. Included are methods to extracts or replace subsets from timeDate objects, to perform arithmetic "+" and "-" operations, to group 'Ops' generic functions, to return suitably lagged and iterated differences, to return differences of two timeDate objects, to concatenate objects, to replicate objects, to rounds objects, to truncates objects, to extract the first or last entry of a vector, to sort the objects of the elements of a date/time vector, and to revert timeDate vector objects.

Transformation of Objects:

This is a collection of S3 methods for objects of class timeDate to transform those objects between different representations. Included are methods to transform timeDate objects to character strings, to data frames, to POSIXct or POSIXlt objects, to Julian counts, to extract date/time atoms from calendar dates, and to extract the months atom from a timeDate object.

Value

rulesFinCenter
listFinCenter
the first function returns a printed list of DST rules, the second lists time zones available in the database.

timedate
timeCalendar
timeSequence
return a S4 object of class 'timeDate'.

Sys.timeDate
returns the system time as an object of class 'timeDate'.

is.timeDate
returns TRUE or FALSE depending on whether its argument is of timeDate type or not.

print
prints the financial center and date and time vector for a timeDate object.

summary
returns a summary report of the details of a timeDate object. This includes the starting and end date, the number of dates the format and financial center in use.

format
returns an ISO conform formatted character string.

Note

originally, these functions were written for Rmetrics users using R and Rmetrics under Microsoft's Windows XP operating system where time zones, daylight saving times and holiday calendars are not or insuffeciently supported. The functions are untested for other system environments, but may be used.

The usage of the Ical Library and the introduction of the FinCenter concept was originally develloped for R Version 1.5. The timeDate and timeSeries objects were added for R Version 1.8.1. Minor changes were made to adapt the functions for R Version 1.9.1. As a consequence, newer concepts like the Date objects were not yet considered and included in this collection of date and time concepts. With R Version 2.3.0 a major update has been made adding many new generic functions and renaming a few already existing functions, please be aware of this.

Note, the date/time conversion from an arbitry timezone to GMT cannot be unique, since date/time objects appear twice during the hour when DST changes. A bookkeeping which takes care if DST is effective or not is not yet included. However, in most applications this is not necessary since the markets are closed on weekends, especially at times when DST usually changes. It is planned for the future to implement the DST change properly.

The ISO-8601 midnight standard has been implemented. Note, that for example "2005-01-01 24:00:00" is a valid date/time string.

Beside the examples given in the manual pages additional demo and test files are available with much more examples including also those from the book of Zivot and Wang (2003).

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

References

Bateman R., (2000); Time Functionality in the Standard C Library, Novell AppNotes, September 2000 Issue, 73–85.

ISO-8601, (1988); Data Elements and Interchange Formats - Information Interchange, Representation of Dates and Time, International Organization for Standardization, Reference Number ISO 8601, 14 pages.

James D.A., Pregibon D. (1992), Chronological Objects for Data Analysis, Reprint.

Ripley B.D., Hornik K. (2001); Date-Time Classes, R-News, Vol. 1/2 June 2001, 8–12.

Zivot, E., Wang J. (2003); Modeling Financial Time Series with S-Plus, Springer, New-York.

See Also

timeDateCoercion, timeDateSpecDates

We also recommend to inspect the help pages for the POSIX time and date class, ?Dates, and the help pages from the contributed R packages chron and date.

Examples

## SOURCE("fCalendar.3A-TimeDateClass")

## myFinCenter -
   myFinCenter

## - Character Vecor Strings:
   dts = c("1989-09-28", "2001-01-15", "2004-08-30", "1990-02-09")
   dts
   tms = c(  "23:12:55",   "10:34:02",   "08:30:00",   "11:18:23")
   tms

## timeDate -
   timeDate(dts, format = "%Y-%m-%d", FinCenter = "GMT" )
   timeDate(dts, format = "%Y-%m-%d", FinCenter = "Europe/Zurich")
   timeDate(paste(dts, tms), format = "%Y-%m-%d %H:%M:%S",
     zone = "GMT", FinCenter = "GMT")
   timeDate(paste(dts, tms), format = "%Y-%m-%d %H:%M:%S",
     zone = "Europe/Zurich", FinCenter = "Europe/Zurich")
   timeDate(paste(dts, tms), format = "%Y-%m-%d %H:%M:%S",
     zone = "GMT", FinCenter = "Europe/Zurich")

## timeCalendar -
   timeCalendar( m = c(9, 1, 8, 2), d = c(28, 15, 30, 9),
     y = c(1989, 2001, 2004, 1990), FinCenter = "GMT")
   timeCalendar(m = c(9, 1, 8, 2), d = c(28, 15, 30, 9),
     y = c(1989, 2001, 2004, 1990), FinCenter = "Europe/Zurich")
   timeCalendar(h = c(9, 14), min = c(15, 23))

## timeSequence -
   timeSequence(from = "2004-03-12", to = "2004-04-11",
        format = "%Y-%m-%d", FinCenter = "GMT")
   timeSequence(from = "2004-03-12", to = "2004-04-11",
        format = "%Y-%m-%d", FinCenter = "Europe/Zurich")

## timeDate -
   # Note, ISO and American Formats are Auto-Detected
   timeDate("2004-12-11", FinCenter = "GMT")
   timeDate("12/11/2004", FinCenter = "GMT")

## print | summary | format -
   tC = timeCalendar()
   print(tC)
   summary(tC)
   format(tC)


timeDate Class, Subsetting

TimeDateSubsets(fCalendar) R Documentation

timeDate Class Subsetting

Description

A collection and description of functions and methods for subsetting 'timeDate' objects.

Functions for testing 'timeDate' objects:

isWeekday | Tests if a date is a weekday or not,
isWeekend | Tests if a date falls on a weekend or not,
isBizday | Tests if a date is a business day or not,
isHoliday | Tests if a date is a non-business day or not.

Functions for getting additional information on 'timeDate' objects:

getDayOfWeek | Returns the day of the week to a 'timeDate' object,
getDayOfYear | Returns the day of the year to a 'timeDate' object.

Functions to extract subsets from 'timeDate' objects:

[.timeDate | Extracts or replaces subsets from 'timeDate' objects,
cut.timeDate | Extracts a piece from a 'timeDate' object,
start.timeDate | Extracts the first entry of a 'timeDate' object,
end.timeDate | Extracts the last entry of a 'timeDate' object,
length.timeDate | Gets the length of a 'timeDate' object,
blockStart | Creates start dates for equally sized blocks,
blockEnd | Creates end dates for equally sized blocks.

Usage

isWeekday(x)
isWeekend(x)
isBizday(x, holidays = holidayNYSE())
isHoliday(x, holidays = holidayNYSE())

getDayOfWeek(x)
getDayOfYear(x)

## S3 method for class 'timeDate':
x[..., drop = TRUE]
## S3 method for class 'timeDate':
cut(x, from , to, ...)
## S3 method for class 'timeDate':
start(x, ...)
## S3 method for class 'timeDate':
end(x, ...)
## S3 method for class 'timeDate':
length(x)

blockStart(x, block = 20)
blockEnd(x, block = 20)

Arguments

block | an integer value specifying the length in number of records for numerically sized blocks of dates.
drop | ["["] - a logical flag, by default TRUE.
from, to | starting date, required, and end date, ptional. If supplied to must be after from.
holidays | [isBizday] - holiday dates from a holiday calendar. An object of class timeDate.
method | [modify] - a character string defining the modification method, one of "sort", "round", or "trunc".
x | [isWeekday][isWeekend][isBizday][weekDay] - an object of class timeDate. [format][print] - an object of class timeDate.
... | arguments passed to other methods.

Value

isWeekday
isWeekend
isBizday
isHoliday
the functions return logical vectors indicating if a date is a weekday, a weekend day, a business day, or a holiday. Note for business and holidays extraction an holiday/business calendar has to be specified.

getDayOfWeek
getDayOfYear the function getDayOfWeek returns a three letter character string with the names of the day of the week, and the function getDayOfWeek returns the day count as integer value starting January, 1st.

[.timeDate
cut.timeDate
start.timeDate
end.timeDate
blockStart
blockEnd
these are functions for subsetting "timeDate" objects. The function [.timeDate extracts or replaces subsets, the function cut extracts a piece, the functions start and end extract the first and last element, the functions blockStart and blockEnd create vectors of start and end values for equally sized blocks. All functions return an object of class "timeDate".

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

See Also

timeDateCoercion, timeDateCoercion, timeDateMathOps, timeDateSpecDates

We also recommend to inspect the help pages for the POSIX time and date class, ?Dates, and the help pages from the contributed R packages chron and date.

Examples

## SOURCE("fCalendar.3B-TimeDateSubsets")

## Easter -
   currentYear

## Easter -
   Easter(currentYear)
   tS = timeSequence(from = Easter(currentYear)-7*24*3600, length.out = 8)
   tS

## Weekdays and Weekend Days:
   isWeekday(tS)
   isWeekend(tS)
   getDayOfWeek(tS)

## Business Days and Holidays:
   holidayNYSE()
   isBizday(tS, holidayNYSE())
   isHoliday(tS, holidayNYSE())

## [ - Subsetting:
   tS[c(1, 6:8)]
   tS[isBizday(tS)]
   tS[isHoliday(tS)]

## cut -
   GoodFriday(currentYear)
   EasterMonday(currentYear)
   cut(tS, from = GoodFriday(currentYear), to = EasterMonday(currentYear))

## start | end -
   start(tS)
   end(tS)


timeDate Class, Functions and Methods

TimeDateMathOps(fCalendar) R Documentation

timeDate Class Functions and Methods

Description

A collection and description of functions and methods for mathematical and logical operations on 'timeDate' objects.

The functions to perform mathematical operations:

Ops.timeDate | Group 'Ops' generic functions for 'timeDate' objects,
+.timeDate | Performs arithmetic + operation on 'timeDate' objects,
-.timeDate | Performs arithmetic - operation on 'timeDate' objects,
diff.timeDate | Returns suitably lagged and iterated differences,
difftimeDate | Returns a difference of two 'timeDate' objects,
round.timeDate | Rounds objects of class 'timeDate',
trunc.timeDate | Truncates objects of class 'timeDate'.

The functions to concatenate, sort and order 'timeDate' objects:

c.timeDate | Concatenates 'timeDate' objects,
rep.timeDate | Replicates a 'timeDate' object,
sort.timeDate | Sorts a 'timeDate' object,
sample.timeDate | Resamples a 'timeDate' object,
unique.timeDate | NMakes a 'timeDate' object unique,
rev.timeDate | Reverts a 'timeDate' object.

Usage

## S3 method for class 'timeDate':
Ops(e1, e2)
## S3 method for class 'timeDate':
e1 + e2
## S3 method for class 'timeDate':
e1 - e2
## S3 method for class 'timeDate':
diff(x, lag = 1, differences = 1, ...)
difftimeDate(time1, time2,
    units = c("auto", "secs", "mins", "hours", "days", "weeks"))
## S3 method for class 'timeDate':
round(x, units = c("days", "hours", "mins"), ...)
## S3 method for class 'timeDate':
trunc(x, units = c("days", "hours", "mins"), ...)

## S3 method for class 'timeDate':
c(..., recursive = FALSE)
## S3 method for class 'timeDate':
rep(x, ...)
## S3 method for class 'timeDate':
sample(x, ...)
## S3 method for class 'timeDate':
sort(x, ...)
## S3 method for class 'timeDate':
unique(x, ...)
## S3 method for class 'timeDate':
rev(x)

Arguments

differences | [lag] - an integer indicating the order of the difference.
e1, e2 | ["+"][["-"]["Ops"] - usually objects of class timeDate, in the case of addition and subtraction e2 may be of class numeric.
lag | [lag] - an integer indicating which lag to use.
method | [modify] - a character string defining the modification method, one of "sort", "round", or "trunc".
recursive | [c] - a logical. If recursive is set to TRUE, the function recursively descends through lists combining all their elements into a vector.
time1, time2 | [difftime] - two objects objects of class timeDate.
units | a character string denoting the date/time units in which the results are desired.
x | [isWeekday][isWeekend][isBizday][weekDay] - an object of class timeDate. [format][print] - an object of class timeDate.
... | arguments passed to other methods.

Value

Ops.timeDate
+.timeDate
-.timeDate
diff.timeDate
difftimeDate
round.timeDate
trunc.timeDate
these are functions for mathematical operations. Group code{Ops} are generic functions which manage mathematical operations. The plus operator "+" performs arithmetic "+" operation on timeDate objects, and the minus operator "-" returns a difftime object if both arguments e1 and e2 are "timeDate" objects, or returns a "timeDate" object e2 seconds earlier than e1. For the function, diff.timeDate, if x is a vector of length n and differences=1, then the computed result is equal to the successive differences x[(1+lag):n] - x[1:(n-lag)]. If difference is larger than one this algorithm is applied recursively to x. Note that the returned value is a vector which is shorter than x. The function, difftimeDate, takes a difference of two timeDate objects and returns an object of class "difftime" with an attribute indicating the units. The two functions round and trunc allow to round or to truncate "timedate" objects to the specified unit and return them as "timedate" objects.

c
rep
sample
sort
unique
rev
these are functions to concatenate, to replicate, to resample, to sort, to make unique, and to revert timeDate objects. The functions return an object of class "timeDate".

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

See Also

timeDateClass, timeDateCoercion, timeDateSpecDates

We also recommend to inspect the help pages for the POSIX time and date class, ?Dates, and the help pages from the contributed R packages chron and date.

Examples

## SOURCE("fCalendar.3C-TimeDateMathOps")

## c -
   # Create Character Vectors:
   dts = c("1989-09-28", "2001-01-15", "2004-08-30", "1990-02-09")
   dts
   tms = c(  "23:12:55",   "10:34:02",   "08:30:00",   "11:18:23")
   tms

## "+/-" -
   # Add One Day to a Given timeDate Object:
   GMT = timeDate(dts, zone = "GMT", FinCenter = "GMT")
   GMT
   ZUR = timeDate(dts, zone = "GMT", FinCenter = "Europe/Zurich")
   ZUR
   GMT + 24*3600
   ZUR[2] - ZUR[1]

## "[" -
   # Subsets from and Lops for timeDate Objects:
   GMT[GMT < GMT[2]]
   ZUR[ZUR < ZUR[3]] == ZUR[1:3]

## diff -
   # Suitably Lagged and Iterated Differences:
   diff(GMT)
   diff(GMT, lag = 2)
   diff(GMT, lag = 1, diff = 2)
   difftimeDate(GMT[1:2], GMT[-(1:2)])

## c | rep -
   # Concatenate and Replicate timeDate Objects:
   c(GMT[1:2], ZUR[1:2])
   c(ZUR[1:2], GMT[1:2])
   rep(ZUR[2], times = 3)
   rep(ZUR[2:3], times = 2)


timeDate Class, Special Date Functions

TimeDateSpecDates(fCalendar) R Documentation

timeDate Class Special Date Functions

Description

A collection and description of functions for the generation of sequences of dates according to special date rules.

The functions for special 'timeDate' sequences are:

timeFirstDayInMonth | Computes the first day in a given month and year,
timeLastDayInMonth | Computes the last day in a given month and year,
timeFirstDayInQuarter | Computes the first day in a given quarter and year,
timeLastDayInQuarter | Computes the last day in a given quarter and year,
timeNdayOnOrAfter | Computes date that is a "on-or-after" n-day,
timeNdayOnOrBefore | Computes date that is a "on-or-before" n-day,
timeNthNdayInMonth | Computes n-th ocurrance of a n-day in year/month,
timeLastNdayInMonth | Computes the last n-day in year/month.

Usage

timeFirstDayInMonth(charvec, format = "%Y-%m-%d", zone = myFinCenter,
    FinCenter = myFinCenter)
timeLastDayInMonth(charvec, format = "%Y-%m-%d", zone = myFinCenter,
    FinCenter = myFinCenter)

timeFirstDayInQuarter(charvec, format = "%Y-%m-%d", zone = myFinCenter,
    FinCenter = myFinCenter)
timeLastDayInQuarter(charvec, format = "%Y-%m-%d", zone = myFinCenter,
    FinCenter = myFinCenter)

timeNdayOnOrAfter(charvec, nday = 1, format = "%Y-%m-%d",
    zone = myFinCenter, FinCenter = myFinCenter)
timeNdayOnOrBefore(charvec, nday = 1, format = "%Y-%m-%d",
    zone = myFinCenter, FinCenter = myFinCenter)

timeNthNdayInMonth(charvec, nday = 1, nth = 1, format = "%Y-%m-%d",
    zone = myFinCenter, FinCenter = myFinCenter)
timeLastNdayInMonth(charvec, nday = 1, format = "%Y-%m-%d",
    zone = myFinCenter, FinCenter = myFinCenter)

Arguments

charvec | a character vector of dates and times.
FinCenter | a character with the the location of the financial center named as "continent/city".
format | the format specification of the input character vector.
nday | an integer vector with entries ranging from 0 (Sunday) to 6 (Saturday).
nth | an integer vector numbering the n-th occurence.
zone | the time zone or financial center where the data were recorded.

Details

We have implemented functions to generate special "timeDate" sequences. These are functions to compute the last day in a given month and year, to compute the dates in a month that is a n-day on or after a given date, to compute the dates in a month that is a n-day on or before a specified date, to compute the n-th ocurrances of a n-day for a specified year/month vectors, and finally to compute the last n-day for a specified year/month value or vector. n-days are numbered from 0 to 6 where 0 correspond to the Sunday and 6 to the Saturday.

Value

timeLastDayInMonth
timeFirstDayInMonth
timeLastDayInQuarter
timeFirstDayInQuarter
timeNdayOnOrAfter
timeNdayOnOrBefore
timeNthNdayInMonth
timeLastNdayInMonth
these functions return timeDate objects on special dates. For the functions timeLastDayInMonth and timeLastDayInMonth return the last or first day respectively in a given month and year. The same functionality for quarterly time horizons is returned by the functions timeLastDayInQuarter and timeLastDayInQuarter. Ror the function timeNdayOnOrAfter the date in the specified month that is a n-day (e.g. Sun-day) on or after a given date, for timeNdayOnOrBefore the date that is a n-day on or before a given date, for timeNthNdayInMonth the nth ocurrance of a n-day (nth = 1,...,5) in year, month, and for {timeLastNdayInMonth} the last nday in year, month will be returned as "timeDate" objects.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

See Also

timeDate

Examples

## SOURCE("fCalendar.3D-TimeDateSpecDates")

## Date as character String:
   charvec = "2006-04-16"

## timeLastDayInMonth-
   # What date has the last day in a month for a given date ?
   timeLastDayInMonth(charvec, format = "%Y-%m-%d", zone = myFinCenter, FinCenter = myFinCenter)
   timeLastDayInMonth(charvec)
   timeLastDayInMonth(charvec, FinCenter = "Zurich")

## timeFirstDayInMonth -
   # What date has the first day in a month for a given date ?
   timeFirstDayInMonth(charvec)

## timeLastDayInQuarter -
   # What date has the last day in a quarter for a given date ?
   timeLastDayInQuarter(charvec)

## timeFirstDayInQuarter -
   # What date has the first day in a quarter for a given date ?
   timeFirstDayInQuarter(charvec)

## timeNdayOnOrAfter
   # What date has the first Monday on or after March 15, 1986 ?
   timeNdayOnOrAfter("1986-03-15", 1)

## timeNdayOnOrBefore
   # What date has Friday on or before April 22, 1977 ?
   timeNdayOnOrBefore("1986-03-15", 5)

## timeNthNdayInMonth -
   # What date is the second Monday in April 2004 ?
   timeNthNdayInMonth("2004-04-01", 1, 2)

## timeLastNdayInMonth -
   # What date has the last Tuesday in May, 1996 ?
   timeLastNdayInMonth("1996-05-01", 2)


timeDate Class, Coercion and Transformation

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)


timeSeries Class

Description

A collection and description of functions and methods dealing with regular and irregular 'timeSeries' objects. Dates and times are implemented as 'timeDate' objects. Included are functions and methods for the generation and representation of 'timeSeries' objects, and for mathematical operations.

Functions to generate and modify 'timeSeries' objects:

timeSeries | Creates a 'timeSeries' object from scratch,
readSeries | Reads a 'timeSeries' from a spreadsheet file,
returnSeries | Computes returns from a 'timeSeries' object,
durationSeries | Computes durations from a 'timeSeries' object,
midquoteSeries | Computes mid quotes from a 'timeSeries' object,
spreadSeries | Computes spreads from a 'timeSeries' object,
applySeries | Applies a function to margins of a 'timeSeries',
orderStatistics | Computes order statistic of a 'timeSeries'.

Data Slot and classification of 'timeSeries' objects:

seriesData | Extracts data slot from a 'timeSeries',
isUnivariate | Tests if a 'timeSeries' object is univariate,
isMultivariate | Tests if a 'timeSeries' object is multivariate.

Functions to print and plot 'timeSeries' objects:

print.timeSeries | S3: Print method for a 'timeSeries' object,
summary.timeSeries | S3: Summary method for a 'timeSeries' object,
plot.timeSeries | S3: Plot method for a 'timeSeries' object,
lines.timeSeries | S3: Lines method for a 'timeSeries' object,
points.timeSeries | S3: Points method for a 'timeSeries' object.

Special Functions for daily 'timeSeries' objects:

dummyDailySeries | Creates a dummy daily 'timeSeries' object,
alignDailySeries | Aligns a daily 'timeSeries' to new positions,
ohlcDailyPlot | Plots open high low close bar chart.

Usage

timeSeries(data, charvec, units = NULL, format = NULL, zone = myFinCenter,
    FinCenter = myFinCenter, recordIDs = data.frame(), title = NULL,
    documentation = NULL, ...)
readSeries(file, header = TRUE, sep = ";", zone = myFinCenter,
    FinCenter = myFinCenter, title = NULL, documentation = NULL, ...)
returnSeries(x, type = c("continuous", "discrete"), percentage = FALSE,
    trim = TRUE, digits = 4, units = NULL)
durationSeries(x, trim = FALSE, units = c("secs", "mins", "hours"))
midquoteSeries(x, which = c("Bid", "Ask"))
spreadSeries(x, which = c("Bid", "Ask"), tickSize = NULL)

applySeries(x, from = NULL, to = NULL, by = c("monthly", "quarterly"),
    FUN = colAvgs, units = NULL, format = x@format, zone = x@FinCenter,
    FinCenter = x@FinCenter, recordIDs = data.frame(), title = x@title,
    documentation = x@documentation, ...)

orderStatistics(x)

seriesData(object)
isUnivariate(x)
isMultivariate(x)

## S3 method for class 'timeSeries':
print(x, recordIDs = FALSE, ...)
## S3 method for class 'timeSeries':
summary(object, ...)
## S3 method for class 'timeSeries':
plot(x, ...)
## S3 method for class 'timeSeries':
lines(x, ...)
## S3 method for class 'timeSeries':
points(x, ...)

dummyDailySeries(x = rnorm(365), units = "X", zone = myFinCenter,
    FinCenter = myFinCenter)
alignDailySeries(x, method = c("before", "after", "interp", "fillNA"),
    include.weekends = FALSE, units = NULL, zone = myFinCenter,
    FinCenter = myFinCenter)
ohlcDailyPlot(x, volume = TRUE, colOrder = c(1:5), units = 1e6,
    xlab = c("Date", "Date"), ylab = c("Price", "Volume"),
    main = c("O-H-L-C", "Volume"), grid.nx = 7, grid.lty = "solid", ...)

Arguments

by | [applySeries] - a character either "monthly" or "quarterly". The default value is "monthly". Only operative when both arguments from and to have ther default values NULL. In this case the function FUN will be applied to monthly or quarterly periods.
charvec | a character vector of dates and times.
colOrder | [ohlcDailyPlot] - an integer vector which gives the order of the prices and the volume in the input object. By default the following order of columns from 1 to 5 is assumed: Open, high, low, close, and volume.
data | a data.frame or a matrix object of numeric data.
digits | [returnSeries] - an integer value. The number of digits to be printed in the output.
documentation | optional documentation string, or a vector of character strings.
file | the filename of a spreadsheet data set from which to import the data records.
FinCenter | a character with the the location of the financial center named as "continent/city".
header | a logical value indicating whether the file contains the names of the variables as its first line. If missing, the value is determined from the file format: 'header' is set to 'TRUE' if and only if the first row contains one fewer field than the number of columns.
format | the format specification of the input character vector, [as.timeSeries] - a character string with the format in POSIX notation to be passed to the time series object.
from, to | starting date and end date, to must be after from.
FUN | [applySeries] - a function to use for aggregation, by default colAvgs.
grid.lty, grid.nx | [ohlcDailyPlot] - The type of grid line and the number of grid lines used in the plot.
include.weekends | [alignDailySeries] - a logical value. Should weekend dates be included or removed from the series.
tickSize | [spreadSeries] - the default is NULL to simply compute price changes in original price levels. If ticksize is supplied, the price changes will be divided by the value of inTicksOfSize to compute price changes in ticks.
main | [ohlcDailyPlot] - a character string to title the price and volume plot.
method | [alignDailySeries] - the method to be used for the alignment. A character string, one of "before", use the data from the row whose position is just before the unmatched position, or "after", use the data from the row whose position is just after the unmatched position, or "linear", interpolate linearly between "before" and "after".
object | [is][seriesData][seriesPositions][summary] - an object of class timeSeries.
percentage | [returnSeries] - a logical value. By default FALSE, if TRUE the series will be expressed in percentage changes.
recordIDs | a data frame which can be used for record identification information. [print] - a logical value. Should the recordIDs printed together with the data matrix and time series positions?
sep | [readSeries] - the field seperator used in the spreadsheet file to separate columns.
title | an optional title string, if not specified the inputs data name is deparsed.
trim | [diffSeries][returnSeries] - a logical value. By default TRUE, the first missing observation in the return series will be removed.
type | [returnSeries] - a character string specifying how to compute the returns. Valid choices are: continuous and discrete. For the default type="continuous", the returns are calculated as the logarithmic differences, otherwise if type="discrete", the returns are calculated as percentage changes.
units | [applySeries][lag][allignDailySeries][returnSeries][mergeSeries] - an optional character string, which allows to overwrite the current column names of a timeSeries object. By default NULL which means that the column names are selected automatically. [durationSeries] - a character value or vector which allows to set the units in which the durations are measured. By default durations are measured in seconds. [ohlcDailyPlot] - a numeric value, specifying in which multiples the volume should be referenced on the plot labels. By default 1e6, i.e. in units of 1 Million.
volume | [ohlcDailyPlot] - a logigical value. Should a volume plot added to the OHLC Plot. By default TRUE.
which | [midquoteSeries][spreadSeries] - a vector with two character strings naming the column names of the time series from which to compute the mid quotes and spreads. By default these are bid and ask prices with column names c("Bid", "Ask").
x | [as] - a matrix type object to be converted. [as.vector][as.matrix][as.data.frame] - [applySeries] - [cut][end][mergeSeries][plot][print][rev][start] - an object of class timeSeries.
xlab, ylab | [ohlcDailyPlot] - two string vectors to name the x and y axis of the price and volume plot.
zone | the time zone or financial center where the data were recorded.
... | arguments passed to other methods.

Details

Generation of Time Series Objects:

We have defined a timeSeries class which is in many aspects similar to the S-Plus class with the same name, but has also some important differences. The class has seven Slots, the 'Data' slot which holds the time series data in matrix form, the 'position' slot which holds the time/date as a character vector, the 'format' and 'FinCenter' slots which are the same as for the 'timeDate' object, the 'units' slot which holds the column names of the data matrix, and a 'title' and a 'documentation' slot which hold descriptive character strings. Date and time is managed in the same way as for timeDate objects.

Value

timeSeries
readSeries
returnSeries
applySeries
return a S4 object of class timeSeries.

orderStatistics
returns ...

seriesData

extracts the @Data slot from a timeSeries object. Thus, seriesData returns an object of class matrix.

isUnivariate
isMultivariate

returns ...

plot
lines
points
print
plot and print methods for an object of class timeSeries.

Note

These functions were written for Rmetrics users using R and Rmetrics under Microsoft's Windows operating system where timze zones, daylight saving times and holiday calendars are insuffeciently supported.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

Examples

## SOURCE("fCalendar.4A-TimeSeriesClass")

## data - Data Frame:
   # Microsoft Data:
   MSFT.df = data.frame(matrix(c(
   20010326, 57.1250, 57.5000, 55.5625, 56.0625,  31559300,
   20010327, 56.0625, 58.5625, 55.8750, 58.2500,  47567800,
   20010328, 57.3750, 57.9375, 55.3750, 55.5625,  39340800,
   20010329, 55.3750, 57.1875, 54.5625, 55.3750,  43492500,
   20010330, 55.7500, 56.1875, 53.8750, 54.6875,  45600800,
   20010402, 54.8125, 56.9375, 54.6250, 55.8125,  37962000,
   20010403, 55.3125, 55.3125, 52.7500, 53.3750,  47093800,
   20010404, 53.3750, 55.0000, 51.0625, 51.9375,  52023300,
   20010405, 53.7500, 57.3750, 53.5000, 56.7500,  56682000,
   20010406, 56.3750, 57.1875, 55.0625, 56.1875,  46311000,
   20010409, 56.5700, 57.4200, 55.6600, 57.1500,  28147800,
   20010410, 57.9500, 60.0900, 57.7800, 59.6800,  54599700,
   20010411, 60.6500, 61.5000, 59.7000, 60.0400,  54939800,
   20010412, 59.5600, 62.3100, 59.3500, 62.1800,  43760000,
   20010416, 61.4000, 61.5800, 60.1200, 60.7900,  32928700,
   20010417, 60.5200, 62.1100, 60.0400, 61.4800,  42574600,
   20010418, 63.3900, 66.3100, 63.0000, 65.4300,  78348200,
   20010419, 65.8100, 69.0000, 65.7500, 68.0400,  79687800,
   20010420, 70.3000, 71.1000, 68.5000, 69.0000,  96459800,
   20010423, 68.1100, 68.4700, 66.9000, 68.2500,  46085600,
   20010424, 68.2000, 69.9300, 67.1400, 67.5500,  44588300,
   20010425, 67.5700, 69.7900, 67.2500, 69.6900,  38372000,
   20010426, 70.0700, 71.0000, 68.2500, 69.1300,  59368800,
   20010427, 69.5300, 69.6800, 66.2100, 67.1200,  60786200,
   20010430, 68.5300, 69.0600, 67.6800, 67.7500,  37184100,
   20010501, 67.6600, 70.3000, 67.6000, 70.1700,  41851400,
   20010502, 71.0000, 71.1500, 69.3500, 69.7600,  46432200,
   20010503, 69.2500, 70.1800, 68.1400, 68.5300,  33136700,
   20010504, 68.0000, 71.0500, 67.9600, 70.7500,  59769200,
   20010507, 70.8300, 72.1500, 70.7000, 71.3800,  54678100),
   byrow = TRUE, ncol = 6))
   colnames(MSFT.df) = c("YYMMDD", "Open", "High", "Low", "Close", "Volume")

   # Load Microsoft Data:
   myFinCenter <<- "GMT"
   MSFT = as.timeSeries(MSFT.df)
   head(MSFT)

## timeSeries - Conversion:
   # Create a timeSeries Objec - The Direct Way ...
   Close = MSFT[, 5]
   head(Close)
   # From Scratch ...
   data = as.matrix(MSFT[, 4])
   charvec = rownames(MSFT)
   Close = timeSeries(data, charvec, units = "Close")
   head(Close)
   c(start(Close), end(Close))

## Cut Series -
   # Cut out April Data from 2001:
   tsApril01 = cut(Close, "2001-04-01", "2001-04-30")
   tsApril01

## Return Series -
   # Compute Returns:
   args(returnSeries)
   # Continuous Returns:
   returnSeries(tsApril01)
   # Discrete Returns:
   returnSeries(tsApril01, type = "discrete")
   # Don't trim:
   returnSeries(tsApril01, trim = FALSE)
   # Use Percentage Values:
   returnSeries(tsApril01, percentage = TRUE, trim = FALSE)

## Align Daily Series -
   # Align with NA:
   args(alignDailySeries)
   tsRet = returnSeries(tsApril01, trim = TRUE)
   GoodFriday(2001)
   EasterMonday(2001)
   alignDailySeries(tsRet, method = "fillNA", include.weekends = FALSE)
   alignDailySeries(tsRet, method = "fillNA", include.weekends = TRUE)

## alignDailySeries -
   # Interpolate:
   tsRet
   alignDailySeries(tsRet, method = "interp", include.weekend = FALSE)
   alignDailySeries(tsRet, method = "interp", include.weekend = TRUE)

## applySeries -
   # Aggregate weekly:
   GoodFriday(2001)
   to = timeSequence(from = "2001-04-11", length.out = 3, by = "week")
   from = to - 6*24*3600
   from
   to
   applySeries(tsRet, from, to, FUN = sum)


timeSeries Class, Functions and Methods

TimeSeriesData(fCalendar) R Documentation

timeSeries Class Functions and Methods

Description

A collection and description of functions and methods dealing with regular and irregular 'timeSeries' objects. Dates and times are implemented as 'timeDate' objects. Included are functions and methods for the generation and representation of 'timeSeries' objects, and for mathematical operations.

Functions and methods to modify 'timeSeries' objects:

diff | Takes differences from a 'timeSeries' object,
lag | Lags a 'timeSeries' object,
merge | Merges two 'timeSeries' objects,
rbinds | Binds rows of two 'timeSeries' objects,
cumsum | Returns the cumulated sum of a 'timeSeries' object,
lag | Scales and centers a 'timeSeries' object.

Functions and methods for classifying 'timeSeries' objects:

var Computes Variance from a 'timeSeries' object.

Functions and methods for mathematical operations on 'timeSeries' objects:

Ops.timeSeries | S3: Arith method for a 'timeSeries' object,
abs | Returns absolute values of a 'timeSeries' object,
sqrt | Returns square root of a 'timeSeries' object,
exp | Returns the exponential values of a 'timeSeries' object,
log | Returns the logarithm of a 'timeSeries' object,
sign | returns the signs of a 'timeSeries' object,
quantile.timeSeries | Computes quantiles of a 'timeSeries' object.

Functions and methods for subsetting 'timeSeries' objects:

"[" | "[" method for a 'timeSeries' object,
cut | Cuts a block from a 'timeSeries' object,
head | Returns the head of a 'timeSeries' object,
tail | Returns the tail of a 'timeSeries' object,
outliers | Removes outliers from a 'timeSeries' object.

Functions and methods for dimensional operations on 'timeSeries' objects:

dim | Returns the dimension of a 'timeSeries' object,
dimnames | Returns the dimension names of a 'timeSeries' object,
colnames<- | Assigns column names to a 'timeSeries' object,
rownames<- | Assigns row names to a 'timeSeries' object,
is.array | Allows that NCOL and NROW work properly.

Usage

## S3 method for class 'timeSeries':
diff(x, lag = 1, diff = 1, trim = FALSE, pad = NA, ...)
## S3 method for class 'timeSeries':
lag(x, k = 1, trim = FALSE, units = NULL, ...)
## S3 method for class 'timeSeries':
merge(x, y, units = NULL, ...)
## S3 method for class 'timeSeries':
rbind(x, y)
## S3 method for class 'timeSeries':
cumsum(x)
## S3 method for class 'timeSeries':
scale(x, center = TRUE, scale = TRUE)
## S3 method for class 'timeSeries':
var(x, y = NULL, na.rm = FALSE, use)

## S3 method for class 'timeSeries':
Ops(e1, e2)
## S3 method for class 'timeSeries':
abs(x)
## S3 method for class 'timeSeries':
sqrt(x)
## S3 method for class 'timeSeries':
exp(x)
## S3 method for class 'timeSeries':
log(x, base = exp(1))
## S3 method for class 'timeSeries':
sign(x)
## S3 method for class 'timeSeries':
quantile(x, probs = 0.95, ...)

## S3 method for class 'timeSeries':
x[i = min(1, nrow(x@Data]):nrow(x@Data),
    j = min(1, ncol(x@Data)):ncol(x@Data))
## S3 method for class 'timeSeries':
cut(x, from, to, ...)
## S3 method for class 'timeSeries':
head(x, n = 6, recordIDs = FALSE, ...)
## S3 method for class 'timeSeries':
tail(x, n = 6, recordIDs = FALSE, ...)
## S3 method for class 'timeSeries':
outlier(x, sd = 10, complement = TRUE, ...)

## S3 method for class 'timeSeries':
dim(x)
## S3 method for class 'timeSeries':
dimnames(x)
colnames<-.timeSeries(x) <- value
rownames<-.timeSeries(x) <- value
## S3 method for class 'timeSeries':
is.array(x)

Arguments

base | [log] - a positive number. The base with respect to which logarithms are computed. Defaults to e=exp(1).
center, scale | [scale] - either a logical value or a numeric vector of length equal to the number of columns of x.
complement | [outlierSeries] - a logical flag, should the outler series or its complement be returns, by default TRUE which returns the series free of outliers.
diff | [diffSeries] - an integer indicating the order of the difference. By default 1.
dimnames | [as.timeSeries] - a logical, if TRUE the dimension names of the matrix are assigned to the time series object.
e1, e2 | [Ops] - two objects of class timeSeries.
from, to | starting date and end date, to must be after from.
i, j | ["["] - index arguments used for subsettings.
k | [lagSeries] - an integer value. The number of lags (in units of observations). By default 1.
lag | [diffSeries] - an integer indicating which lag to use. By default 1.
method | [alignDailySeries] - the method to be used for the alignment. A character string, one of "before", use the data from the row whose position is just before the unmatched position, or "after", use the data from the row whose position is just after the unmatched position, or "linear", interpolate linearly between "before" and "after".
n | [head][tail] - an integer specifying the number of lines to be returned. By default n=6.
na.rm | [var] - a logical flag. Should missing values be removed? By default FALSE.
pad | [diffSeries] - which value should get the padded values? By default NA. Another choice often used would be zero.
probs | a numeric value or numeric vector of probabilities with values in [0,1].
recordIDs | [head][tail] - a logical value. Should the recordIDs returned together with the data matrix and time series positions?
sd | [outlierSeries] - a numeric value of standard deviations, e.g. 10 means that values larger or smaller tahn ten times the standard deviation will be removed from the series.
trim | [diffSeries][returnSeries] - a logical value. By default TRUE, the first missing observation in the return series will be removed.
units | [applySeries][lag][alignDailySeries][returnSeries][mergeSeries] - an optional character string, which allows to overwrite the current column names of a timeSeries object. By default NULL which means that the column names are selected automatically. [ohlcDailyPlot] - a numeric value, specifying in which multiples the volume should be referenced on the plot labels. By default 1e6, i.e. in units of 1 Million.
use | [var] - an optional character string giving a method for computing covariances in the presence of missing values. This must be (an abbreviation of) one of the strings "all.obs", "complete.obs" or "pairwise.complete.obs".
value | [colnames<-][rownames<-] - a valid value for column names component of dimnames(x). For a "timeSeries" object this is either NULL or a character vector of length the column dimension. Not, row names cannot be assigne for a "timeSeries" object, the function rownames() will stop and return an error message.
x | [as] - a matrix type object to be converted. [as.vector][as.matrix][as.data.frame] - [applySeries] - [cut][end][mergeSeries][plot][print][rev][start] - an object of class timeSeries.
y | [mergeSeries][var] - a matrix type object to be merged with an object of class timeSeries. Must have the same number of rows.
... | arguments passed to other methods.

Details

Generation of Time Series Objects:

We have defined a timeSeries class which is in many aspects similar to the S-Plus class with the same name, but has also some important differences. The class has seven Slots, the 'Data' slot which holds the time series data in matrix form, the 'position' slot which holds the time/date as a character vector, the 'format' and 'FinCenter' slots which are the same as for the 'timeDate' object, the 'units' slot which holds the column names of the data matrix, and a 'title' and a 'documentation' slot which hold descriptive character strings. Date and time is managed in the same way as for timeDate objects.

Value

timeSeries
read.timeSeries
as.timeSeries
return a S4 object of class timeSeries.

seriesData
seriesPositions
extract the @Data and @position slots from a timeSeries object. Thus, seriesData returns an object of class matrix, and seriesPositions returns an object of class timeDate.

is.timeSeries
returns TRUE or FALSE depending on whether its argument is of timeSeries type or not.

aggregateSeries
applySeries
cutSeries
mergeSeries
returnSeries
revSeries
return a S4 object of class timeSeries.

end, start
return a S4 object of class timedate. These are the start and end dates of a timeSeries object.

as.vector
as.matrix
as.data.frame
these are methods which convert a S4 object of class timeSeries either to a vector, a matrix or to a data frame.

plot
lines
points
print
plot and print methods for an object of class timeSeries. Note that the plot function requires the packages its and Hmisc.

Note

These functions were written for Rmetrics users using R and Rmetrics under Microsoft's Windows operating system where timze zones, daylight saving times and holiday calendars are insuffeciently supported.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

Examples

## SOURCE("fCalendar.4B-TimeSeriesData")

## data -
   # Create an artificial timeSeries object:
   myFinCenter <<- "GMT"
   charvec = timeCalendar()
   set.seed(4711)
   data = matrix(exp(cumsum(rnorm(12, sd = 0.1))))
   TS = timeSeries(data, charvec, units = "TS")
   TS
   par(ask = FALSE)
   plot(TS, type = "o", pch = 19)

## diff | scale -
   # Difference and scale the timeSeries Object:
   scale(diff(TS, lag = 2, trim = TRUE))

## lag -
   # Lag the timeSeries Object:
   lag(TS, k = -1:1)

## merge -
   # Merge two timeSeries Object:
   merge(TS, diff(log(TS), units = c("ts", "diffLog")))

## var -
   # Variance of a timeSeries Object:
   var(returnSeries(TS, percentage = TRUE))

## Ops | +/- * ^ ...
   # Mathematical Operations:
   TS^2
   TS[2:4]
   OR = returnSeries(TS)
   OR
   OR > 0
   quantile(OR, probs = c(0.90, 0.95))


timeSeries, Positions

TimeSeriesPositions(fCalendar) R Documentation

timeSeries Positions

Description

A collection and description of functions and methods extracting and modifying positions on 'timeSeries' objects.

The functions and methods for the Generation of 'timeSeries' Objects are:

seriesPositions | Extracts positions slot from a 'timeSeries',
newPositions<- | Modifies positions of a 'timeSeries' object,
sample.timeSeries | Resamples a 'timeSeries' object in time,
sort.timeSeries | Sorts reverts a 'timeSeries' object in time,
rev.timeSeries | Reverts a 'timeSeries' object in time,
start.timeSeries | Extracts start date of a 'timeSeries' object,
end.timeSeries | Extracts end date of a 'timeSeries' object.

Usage

seriesPositions(object)
newPositions(object) <- value

## S3 method for class 'timeSeries':
start(x, ...)
## S3 method for class 'timeSeries':
end(x, ...)

## S3 method for class 'timeSeries':
sample(x, ...)
## S3 method for class 'timeSeries':
sort(x, ...)
## S3 method for class 'timeSeries':
rev(x)

Arguments

method | [alignDailySeries] - the method to be used for the alignment. A character string, one of "before", use the data from the row whose position is just before the unmatched position, or "after", use the data from the row whose position is just after the unmatched position, or "linear", interpolate linearly between "before" and "after".
object | [is][seriesData][seriesPositions][summary] - an object of class timeSeries.
value | a valid value for that component of newPositions(x), i.e. an object of class "timeDate" with appropriate length.
x | [as] - a matrix type object to be converted. [as.vector][as.matrix][as.data.frame] - [applySeries] - [cut][end][mergeSeries][plot][print][rev][start] - an object of class timeSeries.
... | arguments passed to other methods.

Value

timeSeries
read.timeSeries
as.timeSeries
return a S4 object of class timeSeries.

seriesData
seriesPositions
extract the @Data and @position slots from a timeSeries object. Thus, seriesData returns an object of class matrix, and seriesPositions returns an object of class timeDate.

is.timeSeries
returns TRUE or FALSE depending on whether its argument is of timeSeries type or not.

aggregateSeries
applySeries
cutSeries
mergeSeries
returnSeries
revSeries
return a S4 object of class timeSeries.

end, start
return a S4 object of class timedate. These are the start and end dates of a timeSeries object.

as.vector
as.matrix
as.data.frame
these are methods which convert a S4 object of class timeSeries either to a vector, a matrix or to a data frame.

plot
lines
points
print
plot and print methods for an object of class timeSeries. Note that the plot function requires the packages its and Hmisc.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

Examples

## SOURCE("fCalendar.4C-TimeSeriesPositions")

## Create dummy timeSeries:
   X = timeSeries(matrix(rnorm(24), 12), timeCalendar())

## seriesPositions -
   seriesPositions(X)


timeSeries Class, Coercion and Transformation

TimeSeriesCoercion(fCalendar) R Documentation

timeSeries Class Coercion and Transformation

Description

A collection and description of functions and methods dealing with the coercion of 'timeSeries' objects.

Functions to create 'timeSeries' objects from other objects:

as.timeSeries | Generic function to convert a 'timeSeries' object,
as.timeSeries.default | Returns unchanged the 'timeSeries' object,
as.timeSeries.numeric | Converts from a numeric vector,
as.timeSseries.data.frame | Converts from a numeric vector,
as.timeSeries.matrix | Converts from a matrix,
as.timeSeries.ts | Converts from an object of class 'ts',
as.timeSeries.character | Converts from a named demo file,
as.timeSeries.zoo | Converts an object of class zoo.

Functions to transform 'timeSeries' objects into other objects:

as.vector.timeSeries | Coerces a 'timeSeries' to a vector,
as.matrix.timeSeries | Coerces a 'timeSeries' to a matrix,
as.data.frame.timeSeries | Coerces a 'timeSeries' to a data.frame,
as.ts.timeSeries | S3: Coerces a 'timeSeries' to a 'ts' object.

Usage

is.timeSeries(object)
## S3 method for class 'numeric':
as.timeSeries(x, ...)
## S3 method for class 'data.frame':
as.timeSeries(x, ...)
## S3 method for class 'matrix':
as.timeSeries(x, ...)
## S3 method for class 'ts':
as.timeSeries(x, ...)
## S3 method for class 'character':
as.timeSeries(x, ...)
## S3 method for class 'zoo':
as.timeSeries(x, ...)

## S3 method for class 'timeSeries':
as.vector(x, mode = "any")
## S3 method for class 'timeSeries':
as.matrix(x)
## S3 method for class 'timeSeries':
as.data.frame(x, row.names = NULL, optional = NULL, ...)
## S3 method for class 'timeSeries':
as.ts(x, ...)

Arguments

mode | a character string giving an atomic mode or "list", or (not for 'vector') "any".
object | an object of class timeSeries.
optional | A logical value. If TRUE, setting row names and converting column names (to syntactic names) is optional.
row.names | NULL or a character vector giving the row names for the data frame. Missing values are not allowed.
x | an object which is coerced according to the generic function.
... | arguments passed to other methods.

Value

is.timeSeries
returns TRUE or FALSE depending on whether its argument is of timeSeries type or not.

as.timeSeries

returns a S4 object of class timeSeries.

as.vector
as.data.frame
as.matrix
as.ts
return depending on the generic function a numeric vector, a data frame, a matrix, or an object of class ts.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

Examples

## SOURCE("fCalendar.4D-TimeSeriesCoercion")

## data - timeSeries:
   # Create an artificial timeSeries object:
   myFinCenter <<- "GMT"
   charvec = timeCalendar()
   data = matrix(rnorm(12))
   TS = timeSeries(data, charvec, units = "RAND")
   TS

## Test for timeSeries:
   is.timeSeries(TS)

## As Vector:
   as.vector(TS)

## As Matrix or Data Frame:
   as.matrix(TS)
   as.data.frame(TS)

## As Univariate Object of Class 'ts':
   as.ts(TS)


Public and Ecclesiastical Holidays

Description

A collection and description of functions and methods dealing with holiday dates in the G7 countries and Switzerland.

Usage

Septuagesima(year)
Quinquagesima(year)
AshWednesday(year)
PalmSunday(year)
GoodFriday(year)
Easter(year)
EasterSunday(year)
EasterMonday(year)
RogationSunday(year)
Ascension(year)
Pentecost(year)
PentecostMonday(year)
TrinitySunday(year)
CorpusChristi(year)
ChristTheKing(year)
Advent1st(year)
Advent2nd(year)
Advent3rd(year)
Advent4th(year)
ChristmasEve(year)
ChristmasDay(year)
BoxingDay(year)
NewYearsDay(year)
SolemnityOfMary(year)
Epiphany(year)
PresentationOfLord(year)
Annunciation(year)
TransfigurationOfLord(year)
AssumptionOfMary(year)
BirthOfVirginMary(year)
CelebrationOfHolyCross(year)
MassOfArchangels(year)
AllSaints(year)
AllSouls(year)
LaborDay(year)
CHBerchtoldsDay(year)
CHSechselaeuten(year)
CHAscension(year)
CHConfederationDay(year)
CHKnabenschiessen(year)
GBMayDay(year)
GBBankHoliday(year)
GBSummerBankHoliday(year)
GBMilleniumDay(year)
DEAscension(year)
DECorpusChristi(year)
DEGermanUnity(year)
DEChristmasEve(year)
DENewYearsEve(year)
FRFetDeLaVictoire1945(year)
FRAscension(year)
FRBastilleDay(year)
FRAssumptionVirginMary(year)
FRAllSaints(year)
FRArmisticeDay(year)
ITEpiphany(year)
ITLiberationDay(year)
ITAssumptionOfVirginMary(year)
ITAllSaints(year)
ITStAmrose(year)
ITImmaculateConception(year)
USDecorationMemorialDay(year)
USPresidentsDay(year)
USNewYearsDay(year)
USInaugurationDay(year)
USMLKingsBirthday(year)
USLincolnsBirthday(year)
USWashingtonsBirthday(year)
USMemorialDay(year)
USIndependenceDay(year)
USLaborDay(year)
USColumbusDay(year)
USElectionDay(year)
USVeteransDay(year)
USThanksgivingDay(year)
USChristmasDay(year)
USCPulaskisBirthday(year)
USGoodFriday(year)
CAVictoriaDay(year)
CACanadaDay(year)
CACivicProvincialHoliday(year)
CALabourDay(year)
CAThanksgivingDay(year)
CaRemembranceDay(year)
JPNewYearsDay(year)
JPGantan(year)
JPBankHolidayJan2(year)
JPBankHolidayJan3(year)
JPComingOfAgeDay(year)
JPSeijinNoHi(year)
JPNatFoundationDay(year)
JPKenkokuKinenNoHi(year)
JPGreeneryDay(year)
JPMidoriNoHi(year)
JPConstitutionDay(year)
JPKenpouKinenBi(year)
JPNationHoliday(year)
JPKokuminNoKyujitu(year)
JPChildrensDay(year)
JPKodomoNoHi(year)
JPMarineDay(year)
JPUmiNoHi(year)
JPRespectForTheAgedDay(year)
JPKeirouNOhi(year)
JPAutumnalEquinox(year)
JPShuubunNoHi(year)
JPHealthandSportsDay(year)
JPTaiikuNoHi(year)
JPNationalCultureDay(year)
JPBunkaNoHi(year)
JPThanksgivingDay(year)
JPKinrouKanshaNoHi(year)
JPEmperorsBirthday(year)
JPTennouTanjyouBi(year)
JPBankHolidayDec31(year)

Arguments

year an integer value or vector of year numbers including the century. These are integers of the form CCYY, e.g. 2000.

Value

Returns an ISO-8601 formatted calendar date CCYYMMDD, an object of class "sdate" which represents an integer value or vector.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

Examples

## SOURCE("fCalendar.5C-HolidayDates")

## CHSechselaeuten -
   # Sechselaeuten a half Day Bank Holiday in Switzerland
   CHSechselaeuten(2000:2010)
   CHSechselaeuten(currentYear)

## German Unification Day:
   DEGermanUnity(currentYear)


Holiday Calendars and Utilities

Description

A collection and description of functions and methods dealing with holiday dates and holiday calendars.

The functions for the generation of holiday calendars are:

holiday | Returns a holiday date of G7 and CH as 'sdate',
holidayNYSE | Computes 'timeDate' object for full-day NYSE holidays,
holidayZURICH | Computes 'timeDate' object for Zurich holidays.

Usage

holiday(year, Holiday = Easter)
holidayNYSE(year = currentYear)
holidayZURICH(year = currentYear)

Arguments

Holiday | the unquoted function name of an ecclestial or public holiday in the G7 countries or Switzerland, see the list below.
year | an integer vector of years, [CCYY]. [day.of.week] - cr vector of integer year numbers.

Details

Holiday Calendar:

Easter is the central ecclestial holiday. Many other holidays are related to this feast. The function easter computes the dates of easter and related ecclestial holidays for the requested year vector. holiday calculates the dates of ecclestial or publich holidays in the G7 countries, e.g. holiday(2003, "GoodFriday"). holidays.db is our Data Base of World Wide Holidays. The database contains holiday functions automatically loaded by the fBasics library at startup time. The user can add additional holiday functions to this data base. The information for the holiday data base were collected from several web pages about holiday calendars. The following ecclestial and public [HOLIDAY] functions in the G7 countries and Switzerland are available:

Holidays Related to Easter:
Septuagesima, Quinquagesima, AshWednesday, PalmSunday, GoodFriday, EasterSunday, Easter, EasterMonday, RogationSunday, Ascension, Pentecost, PentecostMonday, TrinitySunday CorpusChristi.

Holidays Related to Christmas:
ChristTheKing, Advent1st, Advent1st, Advent3rd, Advent4th, ChristmasEve, ChristmasDay, BoxingDay, NewYearsDay.

Other Ecclestical Feasts:
SolemnityOfMary, Epiphany, PresentationOfLord, Annunciation, TransfigurationOfLord, AssumptionOfMary, AssumptionOfMary, BirthOfVirginMary, CelebrationOfHolyCross, MassOfArchangels, AllSaints, AllSouls.

CHZurich - Public Holidays:
CHBerchtoldsDay, CHSechselaeuten, CHAscension, CHConfederationDay, CHKnabenschiessen.

GBLondon - Public Holidays:
GBMayDay, GBBankHoliday, GBSummerBankHoliday, GBNewYearsEve.

DEFrankfurt - Public Holidays:
DEAscension, DECorpusChristi, DEGermanUnity, DEChristmasEve, DENewYearsEve.

FRParis - Public Holidays:
FRFetDeLaVictoire1945, FRAscension, FRBastilleDay, FRAssumptionVirginMary, FRAllSaints, FRArmisticeDay.

ITMilano - Public Holidays:
ITEpiphany, ITLiberationDay, ITRepublicAnniversary, ITAssumptionOfVirginMary, ITAllSaints, ITWWIVictoryAnniversary, ITStAmrose, ITImmaculateConception.

USNewYork/USChicago - Public Holidays:
USNewYearsDay, USInaugurationDay, USMLKingsBirthday, USLincolnsBirthday, USWashingtonsBirthday, USMemorialDay, USIndependenceDay, USLaborDay, USColumbusDay, USElectionDay, USVeteransDay, USThanksgivingDay, USChristmasDay, USCPulaskisBirthday, USGoodFriday.

CAToronto/CAMontreal - Public Holidays:
CAVictoriaDay, CACanadaDay, CACivicProvincialHoliday, CALabourDay, CAThanksgivingDay, CaRemembranceDay.

JPTokyo/JPOsaka - Public Holidays:
JPNewYearsDay, JPGantan, JPBankHolidayJan2, JPBankHolidayJan3, JPComingOfAgeDay, JPSeijinNoHi, JPNatFoundationDay, JPKenkokuKinenNoHi, JPGreeneryDay, JPMidoriNoHi, JPConstitutionDay, JPKenpouKinenBi, JPNationHoliday, JPKokuminNoKyujitu, JPChildrensDay, JPKodomoNoHi, JPMarineDay, JPUmiNoHi, JPRespectForTheAgedDay, JPKeirouNoHi, JPAutumnalEquinox, JPShuubun-no-hi, JPHealthandSportsDay, JPTaiikuNoHi, JPNationalCultureDay, JPBunkaNoHi, JPThanksgivingDay, JPKinrouKanshaNohi, JPKinrou-kansha-no-hi, JPEmperorsBirthday, JPTennou-tanjyou-bi, JPTennou-tanjyou-bi.

All the holiday functions are listed in the data file holidays.R. Additional holidays, which are not yet available there, can be added to this data base file.

Value

holiday
holidayNYSE holidayZURICH
return an ISO-8601 formatted calendar date CCYYMMDD, an object of class "sdate" which represents an integer value or vector.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

References

ISO-8601 (1988); Data Elements and Interchange Formats - Information Interchange, Representation of Dates and Time, International Organization for Standardization, Reference Number ISO 8601, 14 pages.

Examples

## SOURCE("fCalendar.5B-HolidayCalendars")

## easter -
   # Dates for GoodFriday from 2000 until 2010:
   holiday(2000:2010, "GoodFriday")

## holidays -
   Easter(2000:2010)
   GoodFriday(2000:2010)

## holidayNYSE -
   holidayNYSE(currentYear)


Import Market Data from the Internet

Description

A collection and description of functions to import financial and economic market data from the Internet. Download functions are available for economic and financial market data from Economagic's, from Yahoo's, from the Federal Reserve's, and from the the forecasts.org Internet sites.

The functions are:

economagicImport | Economic series from Economagic's Web site,
yahooImport | daily stock market data from Yahoo's Web site,
yahooSeries | easy to use download from Yahoo,
keystatsImport | key statistics from Yahoo's Web site,
fredImport | time series from St. Louis FRED Web site,
forecastsImport | monthly data from the Financial Forecast Center.

Usage

economagicImport(query, file = "tempfile",
    source = "http://www.economagic.com/em-cgi/data.exe/",
    frequency = c("quarterly", "monthly", "daily"), save = FALSE,
    colname = "VALUE", try = TRUE)
yahooImport(query, file = "tempfile",
    source = "http://chart.yahoo.com/table.csv?", save = FALSE,
    sep = ";", swap = 20, try = TRUE)
keystatsImport(query, file = "tempfile",
    source = "http://finance.yahoo.com/q/ks?s=", save = FALSE,
    try = TRUE)
fredImport(query, file = "tempfile",
    source = "http://research.stlouisfed.org/fred2/series/",
    frequency = "daily", save = FALSE, sep = ";", try = TRUE)
forecastsImport(query, file = "tempfile",
    source = "http://www.forecasts.org/data/data/", save = FALSE,
    try = TRUE)

yahooSeries(symbols = c("^DJI", "IBM"), from = NULL, to = NULL,
    nDaysBack = 365, quote = c("Open", "High", "Low", "Close", "Volume"),
    aggregation = c("d", "w", "m"), returnClass = c("timeSeries", "ts",
    "matrix", "data.frame"), getReturns = FALSE, ...)

show.fWEBDATA(object)
## S3 method for class 'keystats':
print(x, ...)

Arguments

aggregation | [yahooSeries] - a character string denoting the aggregation level of the downloaded data records, d for daily, w for weekly and m for monthly data records.
colname | [economagicImport] - a character string which defines the name of the value column. By default "VALUE".
file | a character string with filename, usually having extension ".csv", where to save the downloaded data.
frequency | a character string, one of "quarterly", "monthly", or "daily", defining the frequency of the data records.
from, to | [yahooSeries] - an ISO-8601 formatted character string of the starting (end) date, e.g. "2005-01-01".
getReturns | [yahooSeries] - a logical flag. Should return values be computed using the function returnSeries?
nDaysBack | [yahooSeries] - an integer giving the length of the download period in number of days starting n days back from today. Only in use if from and to are not specified.
object | an S4 object of class "fWEBDATA".
query | a character string, denoting the location of the data at the web site.
save | a logical value, if set to TRUE the downloaded data file will be stored under the path and file name specified by the string file. By default FALSE.
quote | [yahooSeries] - a character value or vector of strings giving the column name(s) of those instruments to be extracted from the download.
returnClass | [yahooSeries] - a character string naming the class of the object to be returned. By default the function yahooSeries returns a "timeSeries" object, alternatives are: "ts", "matrix", or "data.frame".
sep | a character value, defining the field separator for the destination file which saves the downloaded data records. By default a semicolon.
source | a character string with the download URL.
symbols | [yahooSeries] - a character string value or vector, the Yahoo symbol name(s).
swap | [yahooImport] - an integer value which determines when we swap from the 19th to 20th century, by default 20, i.e. we swap 1920. This is necessary since Yahoo does not list the century in its dates, e.g. "15-Aug-02".
try | a logical value, if set to TRUE the Internet access will be checked.
x | [print.keystats] - an object of class keystats as returned by the function keystatsImport.
... | optional arguments to be passed.

Details

Import data from www.economagic.com

Frequently requested data files from Economagic for the US economy include:

[query] | Description:
var/leading-ind-long | Index of Leading Economic Indicators
beana/t102l01 | Real Gross Domestic Product
fedstl/trsp500 | SP 500 Total Return
fedstl/gnp | Gross National Product in Current Dollars
var/cpiu-long | Consumer Price Index - All Urban Consumers
feddal/ru | Unemployment Rate
fedstl/indpro | Total Industrial Production Index
fedstl/exjpus+2 | FX Rate: Japanese Yen to one US Dollar
fedstl/fedfunds+2 | Federal Funds Rate
fedstl/mdiscrt+2 | Discount Rate
fedbog/tcm30y+2 | 30-Year Treasury Constant Maturity Rate
fedstl/mprime+2 | Bank Prime Loan Rate
fedstl/tb3ms+2 | 3-Month Treasury Bills - Secondary Market
fedstl/tb6ms+2 | 6-Month Treasury Bills - Secondary Market
fedbog/cm+2 | 30 Year Federal Home Loan Mortgages
var/west-texas-crude-long | Price of West Texas Intermediate Crude

Import data from chart.yahoo.com:

The query string is given as

s=SYMBOL&a=DD&b=MM&c=CCYY&g=d&q=q&z=SYMBOL&x=.csv

where SYMBOL has to replaced by the symbol name of the instrument, and DD, MM, and CCYY by the day, month-1 and century/year when the time series should start.

Here are some examples of symbols:

[query] | Description:
^DJI | Dow Jones 30 Industrial Averages
^NYA | New York Stock Exchange Composite
^NDX | Nasdaq 100 Index
^IXIC | Nasdaq Composite Index
^TYX | US 30Y Treasury Bond Index
IBM | BM DJIA Stock
KO | Coca-Cola DJIA Stock

The meaning of the tokens in the query string are the following:

Token | Description
s | Selected Ticker-Symbol
a | First Quote starts with Month (mm)
b | First Quote starts with Day (dd)
c | First Quote starts with Year (ccyy)
d | Last Quote ends with Month (mm)
e | Last Quote ends with Day (dd)
f | Last Quote ends with Year (ccyy)
z | Selected Ticker-Symbol

Note, that month tokens range between 0 and 11 for January to December!

Value

The functions economagicImport, fredImport, and yahooImport return an S4 object of class fWEBDATA with the following slots:

@call | the function call.
@data | the data as downloaded formatted as a data.frame.
@param | a character vector whose elements contain the values of selected parameters of the argument list.
@title | a character string with the name of the download. This can be overwritten specifying a user defined input argument.
@description | a character string with an optional user defined description. By default just the current date when the test was applied will be returned.

The function yahooSeries returns by default an S4 object of class timeSeries or alternatively an object specified by the function argument returnClass.

Note

Internet Download:

Note, that if the service provider changes the data file format it may become necessary to modify and update the functions.
The R package tseries from Adrian Trapletti offers an alternative function to download stock market data and indexes from Yahoo's Internet site.

Functions added to Splus Version:

These functions are only used when running Rmetrics under SPlus. Note, that only part of the functionality is supported which is required running these R functions for Rmetrics under Splus.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

Examples

## Not run:
## SOURCE("fcALENDAR.6A-TimeSeriesImport")

## economagicImport -
   USDEUR = economagicImport(query = "fedny/day-fxus2eu",
     frequency = "daily", colname = "USDEUR")
   # Print Data Slot if Internet Download was Successful:
   if (!is.null(USDEUR)) print(USDEUR@data[1:20, ])

## economagicImport -
   USFEDFUNDS = economagicImport(query = "fedstl/fedfunds+2",
     frequency = "monthly", colname = "USFEDFUNDS")
   if (!is.null(USFEDFUNDS)) print(USFEDFUNDS@data[1:20, ])

## economagicImport -
   USGNP = economagicImport(query = "fedstl/gnp",
     frequency = "quarterly", colname = "USGNP")
   if(!is.null(USGNP)) print(USGNP@data[1:20, ])

## yahooImport -
   # [test 19/20 century change 01-12-1999 -- 31-01-2000]
   query = "s=IBM&a=11&b=1&c=1999&d=0&q=31&f=2000&z=IBM&x=.csv"
   IBM = yahooImport(query)
   if (!is.null(IBM)) print(IBM@data[1:20, ])

## fredImport -
   DPRIME = fredImport("DPRIME")
   if (!is.null(DPRIME)) print(DPRIME@data[1:20, ])
## End(Not run)