Skip to contents

Create a file-backed event table reference

Usage

rxEventTableFile(
  path,
  format = c("auto", "parquet", "csv", "fst", "rds"),
  id = "id"
)

Arguments

path

path to the file containing the event table

format

file format: "auto" (detect from extension), "parquet", "csv", "fst", or "rds"

id

name of the subject ID column

Value

An rxEtFile object

Examples

# \donttest{
mod <- function() {
  ini({
    k <- 0.1
  })
  model({
    d/dt(A) <- -k * A
  })
}
f <- tempfile(fileext = ".rds")
saveRDS(as.data.frame(et(amt = 100) |> et(0:24) |> et(id = 1:4)), f)
etf <- rxEventTableFile(f)
s <- rxSolve(mod, etf, file = tempfile("rxChunk"), chunkSize = 2)
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#>  
#>  
#>  
#>  
head(as.data.frame(s))
#>   id time         A
#> 1  1    0 100.00000
#> 2  1    1  90.48383
#> 3  1    2  81.87316
#> 4  1    3  74.08191
#> 5  1    4  67.03206
#> 6  1    5  60.65310
unlink(f)
# }