Learn R Programming

myIO (version 1.2.0)

setBigData: Attach a big-data source to a myIO widget

Description

`setBigData()` declares the data source that a myIO widget should use for large-dataset rendering and linked-selection coordination.

Usage

setBigData(widget, source, rowkey_col = NULL, ...)

Value

A modified myIO htmlwidget object.

Arguments

widget

A myIO htmlwidget object.

source

A supported big-data source: a `data.frame`, an Arrow table or record-batch reader, a single file path or URL ending in `.parquet`, `.arrow`, `.feather`, or `.csv`, or a `DBIConnection`.

rowkey_col

Optional name of the column that uniquely identifies rows for Crosstalk-compatible linked selections.

...

Additional source-specific options. For DBI sources, pass `table = "name"` so myIO can query the table schema. For file path or URL sources, pass `schema = c("col1", "col2", ...)` or a schema field list.

Details

This function writes the `x.bigdata.*` payload fields consumed by the widget's large-dataset virtualization path and follows its row-key contract. DBI sources are stored as an internal session-scoped marker in `x.bigdata$dbi_handle_internal`; render-time source registration is handled by the source registry phase.

Examples

Run this code
# \donttest{
myIO(data = mtcars) |>
  setBigData(mtcars)

myIO() |>
  setBigData("data/large.parquet", schema = c("id", "x", "y"), rowkey_col = "id")

if (requireNamespace("duckdb", quietly = TRUE)) {
  con <- DBI::dbConnect(duckdb::duckdb())
  obs <- data.frame(id = seq_len(nrow(mtcars)), mpg = mtcars$mpg)
  DBI::dbWriteTable(con, "observations", obs)
  myIO() |>
    setBigData(con, table = "observations", rowkey_col = "id")
  DBI::dbDisconnect(con, shutdown = TRUE)
}
# }

Run the code above in your browser using DataLab