Skip to contents

Convenience wrapper that opens a persistent DuckDB connection to path, registers the data and metadata, then closes the connection.

Usage

write_duckdb_climasus(x, path, view_name = "climasus_data", overwrite = TRUE)

Arguments

x

A climasus_df object.

path

Character. File path for the DuckDB database (e.g. "data/sim.duckdb").

view_name

Character. Name of the table inside the DuckDB file (default: "climasus_data").

overwrite

Logical. Whether to overwrite an existing table (default: TRUE).

Value

invisible(x) — the original climasus_df, updated with backend = "duckdb" in its metadata.

Examples

if (FALSE) { # \dontrun{
df <- write_duckdb_climasus(df, "data/sim_respiratory.duckdb")
sus_meta(df, "backend")  # "duckdb"

# Read back later
con <- duckdb::dbConnect(duckdb::duckdb(), "data/sim_respiratory.duckdb")
df2 <- from_duckdb_climasus(con, "climasus_data")
duckdb::dbDisconnect(con)
} # }