R Under development (unstable) (2026-04-26 r89963 ucrt) -- "Unsuffered Consequences" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(efdm) > library(testthat) > orderresult <- function(res) { + res <- res[do.call(order, res[c("time", "a", "b", "vol", "activity")]),c("time", "a", "b", "vol", "activity", "area")] + row.names(res) <- NULL + res + } > > statespace <- expand.grid(a=1:2, b=1:2, vol=1:5) > state0 <- statespace > actprob <- statespace > actprob$test <- 1 > state0$area <- 0 > state0$area[1] <- 1 > > > act1 <- define_activity("test", character()) > expect_error(transprobs(act1) <- data.frame(vol0 = 1:4, vol1=2:5, prob=1)) > state1 <- runEFDM(state0, actprob, list(act1), 5) > expect_equal(state1$vol, rep(1, 6)) > > act2 <- define_activity("test2", "vol") > transprobs(act2) <- data.frame(vol0=1:5, vol1=c(2:5,5), prob=1) > actprob$test <- 0.1 > actprob$test2 <- 0.9 > orderresult(runEFDM(state0, actprob, list(act1, act2), 5)) time a b vol activity area 1 0 1 1 1 test 0.100000 2 0 1 1 1 test2 0.900000 3 1 1 1 1 test 0.010000 4 1 1 1 1 test2 0.090000 5 1 1 1 2 test 0.090000 6 1 1 1 2 test2 0.810000 7 2 1 1 1 test 0.001000 8 2 1 1 1 test2 0.009000 9 2 1 1 2 test 0.018000 10 2 1 1 2 test2 0.162000 11 2 1 1 3 test 0.081000 12 2 1 1 3 test2 0.729000 13 3 1 1 1 test 0.000100 14 3 1 1 1 test2 0.000900 15 3 1 1 2 test 0.002700 16 3 1 1 2 test2 0.024300 17 3 1 1 3 test 0.024300 18 3 1 1 3 test2 0.218700 19 3 1 1 4 test 0.072900 20 3 1 1 4 test2 0.656100 21 4 1 1 1 test 0.000010 22 4 1 1 1 test2 0.000090 23 4 1 1 2 test 0.000360 24 4 1 1 2 test2 0.003240 25 4 1 1 3 test 0.004860 26 4 1 1 3 test2 0.043740 27 4 1 1 4 test 0.029160 28 4 1 1 4 test2 0.262440 29 4 1 1 5 test 0.065610 30 4 1 1 5 test2 0.590490 31 5 1 1 1 test 0.000001 32 5 1 1 1 test2 0.000009 33 5 1 1 2 test 0.000045 34 5 1 1 2 test2 0.000405 35 5 1 1 3 test 0.000810 36 5 1 1 3 test2 0.007290 37 5 1 1 4 test 0.007290 38 5 1 1 4 test2 0.065610 39 5 1 1 5 test 0.091854 40 5 1 1 5 test2 0.826686 > > proc.time() user system elapsed 1.09 0.17 1.25