export_table | R Documentation |
Stores and load data in various of data format. See 'Details' for limitations.
export_table(
x,
file,
format = c("auto", "csv", "csv.zip", "h5", "fst", "json", "rds", "yaml"),
...
)
import_table(
file,
format = c("auto", "csv", "csv.zip", "h5", "fst", "json", "rds", "yaml"),
...
)
x |
data table to be saved to |
file |
file to store the data |
format |
data storage format, default is |
... |
parameters passed to other functions |
The format 'rds'
, 'h5'
, 'fst'
, 'json'
, and
'yaml'
try to preserve the first-level column attributes. Factors
will be preserved in these formats. Such property does not exist in
'csv'
, 'csv.zip'
formats.
Open-data formats are 'h5'
, 'csv'
, 'csv.zip'
,
'json'
, 'yaml'
. These formats require the table elements to
be native types (numeric, character, factor, etc.).
'rds'
, 'h5'
, and 'fst'
can store large data sets.
'fst'
is the best choice is performance and file size are the major
concerns. 'rds'
preserves all the properties of the table.
The normalized path for export_table
, and a
data.table
for import_table
x <- data.table::data.table(
a = rnorm(10),
b = letters[1:10],
c = 1:10,
d = factor(LETTERS[1:10])
)
f <- tempfile(fileext = ".csv.zip")
export_table(x = x, file = f)
y <- import_table(file = f)
str(x)
str(y)
# clean up
unlink(f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.