## Use Microsofts' OHLCV Price Series -
head(MSFT)
end(MSFT)
## Use MSFT and Compute Sample Size -
dim(MSFT)
## Align the Series -
MSFT.AL <- align(MSFT)
## Show the Size of the Aligned Series -
dim(MSFT.AL)
## alignDailySeries
## 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)
## Load Microsoft Data Set -
x <- MSFT
## Aggregate daily records to end of month records -
X <- daily2monthly(x)
X
isMonthly(X)
## Aggregate daily records to end of week records -
X <- daily2weekly(x, startOn="Fri")
X
dayOfWeek(time(X))
Run the code above in your browser using DataLab