Save px object to file
Arguments
- x
A px object.
- path
Path to file. The file extension determines the format. Can be:
.pxto save as a PX-file.xlsxto save as an Excel workbook.Rto save an R-script that creates the px object
- save_data
If FALSE, no 'Data' sheet is created in the Excel workbook. Can only be used if
pathis an.xlsxfile.- data_path
Path to an
.rdsor.parquetfile to save data table at. Can only be used ifpathis an.xlsxor.Rfile, andsave_dataisTRUE.
Details
Use px_codepage() to change file encoding.
Examples
# Save px object to PX-file
tmp_dir <- tempdir()
x <- px(population_gl)
px_save(x, file.path(tmp_dir, "population.px"))
# Save px object to Excel workbook
px_save(x, file.path(tmp_dir, "population.xlsx"))
# Save px object as R-script that creates the px object
px_save(x, file.path(tmp_dir, "population.R"))
