# Create temporary account
tmpdir <- tempfile()
dir.create(tmpdir)
# Export a CSV file
export(mtcars, file_path = file.path(tmpdir, "file.csv"))
# Export an Excel file
export(mtcars, file_path = file.path(tmpdir, "file.xlsx"))
# Export a Stata DTA file
export(mtcars, file_path = file.path(tmpdir, "file.dta"))
# Export an RDS file
export(mtcars, file_path = file.path(tmpdir, "file.rds"))
# Export an RData file
export(list(mtcars = mtcars, iris = iris),
file_path = file.path(tmpdir, "file.RData"))
# Remove the temporary directory and its contents
unlink(tmpdir, recursive = TRUE)
Run the code above in your browser using DataLab