Running examples in 'popEpi-Ex.R' failed
The error most likely occurred in:

> ### Name: makeWeightsDT
> ### Title: Make a 'data.table' of Tabulated, Aggregated Values and Weights
> ### Aliases: makeWeightsDT
> 
> ### ** Examples
> 
> library(survival)
> library(data.table)
> 
> makeWeightsDT <- popEpi:::makeWeightsDT ## this avoids errors during tests
> 
> sire <- copy(popEpi::sire)
> set.seed(1L)
> sire$sex <- rbinom(nrow(sire), 1, 0.5)
> ag <- lexpand(sire, birth = "bi_date", entry = "dg_date", exit = "ex_date",
+               status = status %in% 1:2, pophaz = popmort, pp = FALSE,
+               aggre = list(sex, agegr = cut(dg_age, c(0,50,75,Inf)), fot), 
+               fot = seq(0, 5, 1/12))
dropped 16 rows where entry == exit
NOTE: 71 rows in split data had values of 'age' higher than max of pophaz's 'agegroup'; the hazard values at 'agegroup' == 100 were used for these
> ps <- quote(list(sex, fot))
> as <- quote(list(agegr))
> vs <- list(quote(list(pyrs, at.risk)))
> ws <- list(agegr = c(0.2,0.4,0.4))
> 
> #### custom.levels usage
> fb <- seq(0, 5-1/12, 1/12) ## exclude 5 as no row has that value
> ag2 <- ag[fot > 0.5,]
> # repeats fot intervals < 0.5 as empty rows
> # may be the safest way to do this
> dt <- makeWeightsDT(ag2, print = ps, adjust = as, 
+                     values = vs, weights = ws,
+                     custom.levels = list(fot = fb))
> ## aggregate from intervals seq(0, 5, 1/12) to 0:5
> fb2 <- 0:5 ## (this time we include 5 as the roof)       
> dt <- makeWeightsDT(ag2, print = ps, adjust = as, 
+                     values = vs, weights = ws,
+                     custom.levels = list(fot = fb2),
+                     custom.levels.cut.low = "fot")              
>                     
> 
> #### use of enclos
> TF <- environment()
> gender <- factor(ag$sex)
> dt <- makeWeightsDT(ag, print = quote(gender), adjust = as, 
+                     values = vs, weights = ws, enclos = TF)
> ## or NULL: uses calling frame by default.
> dt <- makeWeightsDT(ag, print = quote(gender), adjust = as, 
+                     values = vs, weights = ws,
+                     enclos = NULL)
> ## passing parent.fram(1) is the same thing (as below),
> ## but won't pass in testing these examples somehow (but work in real life)
> # dt <- makeWeightsDT(ag, print = quote(gender), adjust = as, 
> #                     values = vs, weights = ws,
> #                     enclos = NULL)                  
> 
> #### formula usage
> form <- Surv(fot, factor(from0to1))~gender
> dt <- makeWeightsDT(ag, formula = form, Surv.response = TRUE,
+                     adjust = as, values = vs, weights = ws,
+                     enclos = NULL)
Error in as.data.table.array(xi, keep.rownames = keep.rownames) : 
  as.data.table.array method should be only called for arrays with 3+ dimensions, for 2 dimensions matrix method should be used
Calls: makeWeightsDT ... Surv2DT -> data.table -> as.data.table -> as.data.table.array
Execution halted