diff --git a/DESCRIPTION b/DESCRIPTION index 2f3d5de..b851889 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: eoR Type: Package Title: Data Management Package (Exposure and Occurrence Data in R) -Version: 0.4.0 -Date: 2019-11-07 +Version: 0.5.0 +Date: 2019-11-22 Authors@R: c(person("Rainer", "Walke", role = c("aut", "cre"), email = "walke@demogr.mpg.de", comment = c(ORCID = "0000-0002-4269-6531"))) @@ -23,4 +23,4 @@ Encoding: UTF-8 Depends: R (>= 3.2.0) Imports: methods, data.table LazyData: no -RoxygenNote: 6.1.1 +RoxygenNote: 7.0.0 diff --git a/tests/generator_DEUTNP.fltper_1x1m.R b/tests/generator_DEUTNP.fltper_1x1m.R index b991b64..0729c78 100644 --- a/tests/generator_DEUTNP.fltper_1x1m.R +++ b/tests/generator_DEUTNP.fltper_1x1m.R @@ -43,34 +43,12 @@ block3 <- function(mult) { ltA[, px := 1 - qx][] + ltA[, lx := 100000 * cumprod(shift(px, 1L, fill=1, type="lag"))][] - # ltA[,pxlag := shift(px, 1L, type="lag")] + ltA[, dx := lx * qx] + ltA[, Lx := lx - ( 1 - ax ) * dx] - ltA[AgeLow==0, lx := 100000][] - - for (x in seq(1,110)) { - - ltA[AgeLow == x, lx := ltA[AgeLow == (x-1), lx] * ltA[AgeLow == (x-1), px]] - - } - - ltA[AgeLow == 110, dx := lx][] - ltA[AgeLow == 110, Lx := lx * ax][] - - for (x in seq(109,0)) { - - ltA[AgeLow == x, dx := lx * qx] - ltA[AgeLow == x, Lx := lx - ( 1 - ax ) * dx] - - } - - ltA[AgeLow == 110, Tx := Lx][] - - for (x in seq(109,0)) { - - ltA[AgeLow == x, Tx := ltA[AgeLow == (x+1), Tx] + Lx] - - } + ltA[, Tx := rev(cumsum(rev(Lx)))] ltA[, ex := Tx / lx][]