Skip to contents

Opens all parquet chunk files as a single lazy arrow::Dataset using arrow::open_dataset(). The dataset can be filtered and selected with dplyr verbs before calling dplyr::collect() to materialise. Requires the arrow package.

Usage

as.arrow(x, ...)

# S3 method for class 'rxSolveOom'
as.arrow(x, ...)

Arguments

x

An rxSolveOom object.

...

Ignored.

Value

An arrow::Dataset.

Details

This is an rxode2 generic: arrow provides open_dataset() but no lazy-dataset coercion generic to dispatch on, so rxode2 defines its own.

Examples

# \donttest{
if (requireNamespace("arrow", quietly = TRUE)) {
mod <- function() {
  ini({
    k <- 0.1
  })
  model({
    d/dt(A) <- -k * A
  })
}
s <- rxSolveChunked(mod, et(amt = 100) |> et(0:24) |> et(id = 1:6), chunkSize = 3)
as.arrow(s)
}
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#>  
#>  
#> FileSystemDataset with 2 Parquet files
#> 3 columns
#> id: int32
#> time: double
#> A: double
#> 
#> See $metadata for additional Schema metadata
# }