Writes a table in a chosen format. "json" and "yaml" are lossless;
"csv", "tsv", "xlsx", "asap", "ris", and "bibtex" are lossy views
and raise a lossy-export warning listing fields that are not preserved as
columns. When audience = "public", sensitive ethics fields are redacted by
default.
Usage
export_krt(
x,
path = NULL,
format = c("json", "yaml", "csv", "tsv", "xlsx", "asap", "ris", "bibtex"),
profile = NULL,
audience = c("author", "public"),
redact = NULL,
attribution = TRUE,
template = NULL,
view = NULL
)
krt_write(
x,
path = NULL,
format = c("json", "yaml", "csv", "tsv", "xlsx", "asap", "ris", "bibtex"),
profile = NULL,
audience = c("author", "public"),
redact = NULL,
attribution = TRUE,
template = NULL,
view = NULL
)Arguments
- x
A krt_tbl.
- path
Output file path, or
NULLto return the content as a string.- format
Output format; inferred from
pathwhen possible.- profile
Profile whose columns tabular exports use (default the table's profile).
- audience
"author"(full) or"public"(redacted).- redact
Redaction strength (
"basic"/"strict") for public exports, orFALSEto disable (with a warning).- attribution
If
TRUE(default) and the profile carries an attribution requirement, write an attribution sidecar next topath.- template
Optional template path for ASAP/xlsx export.
- view
Optional explicit view for tabular formats.
Examples
export_krt(krt_example, format = "json") |> substr(1, 30)
#> [1] "{\n \"schema_version\": \"1.0.0\","
suppressWarnings(export_krt(krt_example, format = "asap")) |> substr(1, 40)
#> [1] "\"RESOURCE TYPE\",\"RESOURCE NAME\",\"SOURCE\""
