write_rcdf_as: Write RCDF data to multiple formats

View source: R/write_rcdf_as.R

write_rcdf_asR Documentation

Write RCDF data to multiple formats

Description

Exports RCDF-formatted data to one or more supported open data formats. The function automatically dispatches to the appropriate writer function based on the 'formats' provided.

Usage

write_rcdf_as(data, path, formats, ...)

Arguments

data

A named list or RCDF object. Each element should be a table or tibble-like object (typically a 'dbplyr' or 'dplyr' table).

path

The target directory where output files should be saved.

formats

A character vector of file formats to export to. Supported formats include: '"csv"', '"tsv"', '"json"', '"parquet"', '"xlsx"', '"dta"', '"sav"', and '"sqlite"'.

...

Additional arguments passed to the respective writer functions.

Value

Invisibly returns 'NULL'. Files are written to disk.

See Also

write_rcdf_csv write_rcdf_tsv write_rcdf_json write_rcdf_xlsx write_rcdf_dta write_rcdf_sav write_rcdf_sqlite

Examples

dir <- system.file("extdata", package = "rcdf")
rcdf_path <- file.path(dir, 'mtcars.rcdf')
private_key <- file.path(dir, 'sample-private-key.pem')

rcdf_data <- read_rcdf(path = rcdf_path, decryption_key = private_key)
temp_dir <- tempdir()

write_rcdf_as(data = rcdf_data, path = temp_dir, formats = c("csv", "xlsx"))

unlink(temp_dir, force = TRUE)

rcdf documentation built on Aug. 28, 2025, 9:09 a.m.