View source: R/stocksCRSPxts.R
stocksCRSPxts | R Documentation |
A function to extract a subset of the stocksCRSP data.table specified by a date range and a set of tickers, with convenient defaults, and convert it to an xts object
stocksCRSPxts(
data,
dateRange = c("1993-01-31", "2015-12-31"),
tickerSet = NULL
)
data |
One of the data.table objects stocksCRSP, stocksCRSPweekly, stocksCRSPdaily |
dateRange |
Character vector with two components a start date and an end date using format "yyyy-mm-dd". Default is the entire stocksCRSP data dates range c("1993-01-31","2015-12-32") |
tickerSet |
A subset of tickers of the stocks in stocksCRSP. The default is tickerSet = NULL, which results in selection of all stocks in stocksCRSP. |
A multivariate xts object of stock returns
data.table::setDTthreads(1)
library(PCRA)
library(xts)
library(data.table)
class(stocksCRSP)
args(stocksCRSPxts)
tickers4 <- c("DHR","CSL","AVP","AMWD")
dateRange <- c("2011-01-31","2015-12-31")
returns4 <- stocksCRSPxts(stocksCRSP, dateRange = dateRange,
tickerSet = tickers4)
class(returns4)
dim(returns4)
names(returns4)
range(index(returns4))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.