This function exports a data frame to a specified file format, including CSV, TSV, RDS, XLSX, and TXT. If the format is not provided, it is inferred from the file extension.
export_matrix(
.data,
file,
format = NULL,
drop_extra = FALSE,
extra_columns = NULL,
silent = FALSE,
...
)Exports the data to a file and returns `NULL` invisibly.
A data frame or tibble to be exported.
A character string specifying the file name and path.
A character string specifying the file format. If `NULL`, the format is inferred from the file extension. Supported formats: `"csv"`, `"tsv"`, `"rds"`, `"xlsx"`, `"txt"`.
Logical. If `TRUE`, removes columns not listed in `extra_columns` before exporting. Default is `FALSE`.
A character vector specifying additional columns to retain if `drop_extra = TRUE`. Default is `NULL`.
Logical. If `TRUE`, suppresses messages. Default is `FALSE`.
Additional arguments passed to the underlying export functions (`write.csv`, `writexl::write_xlsx`, etc.).