mac-theobio / McMasterPandemic

SEIR+ model
GNU General Public License v3.0
20 stars 5 forks source link

Length-zero date construction fails on Windows R4.0.0 #201

Closed stevencarlislewalker closed 2 years ago

stevencarlislewalker commented 2 years ago

Steps

  1. library(McMasterPandemic)
  2. flexmodel(params = c(a = 1), state = c(b = 1))

Actual Result

 Error in as.Date.numeric(numeric(0L)) : 'origin' must be supplied

Expected Results

data frame with 0 columns and 0 rows
stevencarlislewalker commented 2 years ago

Caused by initializing zero-length date vectors, in a manner that is either R version-dependent or OS-dependent.

A possible solution is to use structure(..., class = "Date") instead of as.Date, but this seems hacky.

Flynn-Primrose commented 2 years ago

Changed as.Date.numeric(numeric(0L)) to as.Date.numeric(numeric(0L), origin = "1970-01-01")