Description Usage Arguments Value Author(s) Examples
View source: R/fit.factor.models.R
Function to create a data.table (wide format) from a column of long format, uses reshape2::dcast()
1 | fit.data.cast(datMat, item, id.var, date.var, reverse = FALSE)
|
datMat |
data.table of rawdata |
item |
string name of the data items to extract |
id.var |
string name of the identifier that will make up the row names |
date.var |
string name of the dates that will make up the column names |
reverse |
logical to reverse the dates in the output, so the first column will be the most recent date, defaults to FALSE |
data.table with the first column being the ids and the subsequent columns being the data 'item'
Roger J. Bos, roger.bos@gmail.com
1 2 | load("data/Stock.df.Rdata")
retMat <- fit.data.cast(stock, item='RETURN', id.var = 'TICKER', date.var = 'DATE', reverse = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.