write_data() writes a data frame to any format listed by
supported_formats(). The format is inferred from the file extension
unless format is given; text formats are compressed when the file name
ends in .gz, .bz2 or .xz.
HDF5 files are written with one dataset per column inside a group
(dataset, default "data"), with attributes that record column order,
factor levels, Date/POSIXct classes, time zones and missing strings,
so that read_data() restores the original column types.
Date-times (POSIXct) keep their instant in every format. Text formats
(CSV, TSV, JSON, NDJSON) store them as ISO 8601 strings in UTC; Excel,
SPSS, Stata and SAS files, which store clock time without a time zone,
receive the UTC clock time; Parquet, Feather, fst and HDF5 store the
instant together with the time zone. Pass the original data as template
to read_data() to restore the original time zone.