Skip to content

Commit

Permalink
#43 declaring additional data.table functions
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinMShea committed Oct 13, 2021
1 parent 603d7eb commit c24433e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ importFrom(data.table,last)
importFrom(data.table,melt)
importFrom(data.table,rbindlist)
importFrom(data.table,setcolorder)
importFrom(data.table,setkey)
importFrom(data.table,setkeyv)
importFrom(data.table,setnames)
importFrom(data.table,shift)
Expand Down
4 changes: 2 additions & 2 deletions R/fitFfmDT.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' cross-sectional regressions. It also preps the data. An object of class \code{"ffmSpec"}
#' is returned.
#'
#' @importFrom data.table as.data.table last setkeyv copy shift key setnames setcolorder
#' @importFrom data.table as.data.table last setkey setkeyv copy shift key setnames setcolorder
#'
#' @param data data.frame of the balanced panel data containing the variables
#' \code{asset.var}, \code{ret.var}, \code{exposure.vars}, \code{date.var} and
Expand Down Expand Up @@ -1030,7 +1030,7 @@ calcAssetWeightsForRegression <- function(specObj, fitResults , SecondStepRegres
# now we have to extract the asset level residuals series and get their time series variance or
# robust stats
resid.DT <- data.table::rbindlist(l = fitResults$residuals)
setkey(resid.DT, id, date)
data.table::setkey(resid.DT, id, date)

resid.DT[, idx := 1:.N, by = id] # this is needed for path dependent calculations

Expand Down

0 comments on commit c24433e

Please sign in to comment.