Write a (possibly filtered) summary-statistic object to a Parquet or CSV file. For a `GWASFormatter`, the write streams directly from DuckDB without collecting into R, so it scales to large data and captures whatever filtering has been applied (e.g. via [filter_variants()] or [exclude_difficult_regions()]). `data.frame` and `tibble` inputs are written through a temporary in-memory DuckDB connection.
Usage
write_summary_statistics(
x,
output,
format = NULL,
compression = "snappy",
overwrite = FALSE,
...
)Arguments
- x
A `GWASFormatter` object, `data.frame`, or `tibble`.
- output
Output file path.
- format
Output format, one of `"parquet"` or `"csv"`. Default `NULL`, which infers the format from the extension of `output` (falling back to `"parquet"`).
- compression
Compression codec for Parquet output (e.g. `"snappy"`, `"zstd"`, `"gzip"`, `"uncompressed"`). Ignored for CSV. Default `"snappy"`.
- overwrite
Logical. If `FALSE` (default) and `output` already exists, abort rather than replace it.
- ...
Additional arguments passed to methods.