Skip to contents

Handy wrapper functions to export data tables that then returns the file path of the exported file. This can be useful in applications such as within tarchetypes::tar_file.

Usage

exportCSV(x, file, ...)

exportXLSX(x, file, ...)

Arguments

x

a data frame or tibble to export

file

file or connection to write to

...

arguments to pass to readr::write_csv or xlsx::write.xlsx

Value

The file path of the exported file.

Details

If the file path directory does not exist, the directory is created recuresively prior to export.

Examples

## Export to a csv
exportCSV(iris, paste0(tempdir(),"/iris.csv"))
#> [1] "/tmp/Rtmp98LWue/iris.csv"

## Export to an Excel workbook
exportXLSX(iris, paste0(tempdir(),"/iris.xlsx"))
#> [1] "/tmp/Rtmp98LWue/iris.xlsx"