fit.data.cast: fit.data.cast

Description Usage Arguments Value Author(s) Examples

View source: R/fit.factor.models.R

Description

Function to create a data.table (wide format) from a column of long format, uses reshape2::dcast()

Usage

1
fit.data.cast(datMat, item, id.var, date.var, reverse = FALSE)

Arguments

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

Value

data.table with the first column being the ids and the subsequent columns being the data 'item'

Author(s)

Roger J. Bos, roger.bos@gmail.com

Examples

1
2
load("data/Stock.df.Rdata")
retMat <- fit.data.cast(stock, item='RETURN', id.var = 'TICKER', date.var = 'DATE', reverse = TRUE)

rogerjbos/fit.factor.models documentation built on July 23, 2020, 3:44 p.m.