Skip to content

Commit

Permalink
changing the data.table spare pointer allocation scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
osofr committed Jun 12, 2016
1 parent 8c6a775 commit 5e49b07
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion R/simulation.r
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,12 @@ simFromDAG <- function(DAG, Nsamp, wide = TRUE, LTCF = NULL, rndseed = NULL, rnd
obs.df <- data.frame(ID = seq(vector(length = Nsamp))) # obs.df <- data.frame(ID = seq(1:Nsamp))
obs.dt <- data.table(obs.df)

alloc.col(obs.dt, max(min(length(DAG)+1, 1000), 200)) # need to allocate columns in DT to maximum number of variables
# for efficiency, allocate columns in DT to maximum number of variables, if it exceeds 1025 (default)
DT.cols <- (length(DAG)+1)
if (DT.cols > 1025) {
alloc.col(obs.dt, DT.cols)
}
# alloc.col(obs.dt, max(min(length(DAG)+1, 1000), 200))

#---------------------------------------------------------------------------------
# CHECKS PERFORMED DURING EVALUTION:
Expand Down

0 comments on commit 5e49b07

Please sign in to comment.