SpecialDailySeries {timeSeries} | R Documentation |
Special daily time series
Description
Special daily 'timeSeries' functions.
Usage
alignDailySeries(x, method = c("before", "after", "interp", "fillNA",
"fmm", "periodic", "natural", "monoH.FC"),
include.weekends = FALSE, units = NULL, zone = "",
FinCenter = "", ...)
rollDailySeries(x, period = "7d", FUN, ...)
Arguments
x |
an object of class |
method |
the method to be used for the alignment. A character string, one of
|
include.weekends |
a logical value. Should weekend dates be included or removed from the series? |
units |
an optional character string, which allows to overwrite the current
column names of a |
zone |
the time zone or financial center where the data were recorded. |
FinCenter |
a character with the the location of the financial center named
as |
period |
a character string specifying the rollling period composed by the
length of the period and its unit, e.g. |
FUN |
a function to use for aggregation, by default |
... |
arguments passed to interpolating methods. |
Details
alignDailySeries
aligns a daily 'timeSeries' to new positions,
rollDailySeries
rolls daily a 'timeSeries' on a given period.
Value
for alignDailySeries
, a weekly aligned daily
timeSeries
object from a daily time series with missing
holidays.
for rollDailySeries
, an object of class timeSeries
with rolling values, computed from the function FUN
.
Examples
## Use Microsofts' OHLCV Price Series -
head(MSFT)
end(MSFT)
## Cut out April Data from 2001 -
Close <- MSFT[, "Close"]
tsApril01 <- window(Close, start="2001-04-01", end="2001-04-30")
tsApril01
## Align Daily Series with NA -
tsRet <- returns(tsApril01, trim = TRUE)
GoodFriday(2001)
EasterMonday(2001)
alignDailySeries(tsRet, method = "fillNA", include.weekends = FALSE)
alignDailySeries(tsRet, method = "fillNA", include.weekends = TRUE)
## Align Daily Series by Interpolated Values -
alignDailySeries(tsRet, method = "interp", include.weekend = FALSE)
alignDailySeries(tsRet, method = "interp", include.weekend = TRUE)