Stage a DataFrame by saving it to a HDF5 file.
# S4 method for class 'DataFrame'
saveObject(x, path, ...)
# S4 method for class 'data.frame'
saveObject(x, path, ...)
A DataFrame or data.frame.
String containing the path to a directory in which to save x
.
Additional named arguments to pass to specific methods.
A named list containing the metadata for x
.
x
itself is written to a HDF5 file inside path
.
Additional files may also be created inside path
and referenced from the metadata.
This method creates a basic_columns.h5
file that contains columns for atomic vectors, factors, dates and date-times.
Dates and date-times are converted to character vectors and saved as such inside the file.
Factors are saved as a HDF5 group with both the codes and the levels as separate datasets.
Any non-atomic columns are saved to a other_columns
subdirectory inside path
via saveObject
,
named after its zero-based positional index within x
.
If metadata
or mcols
are present,
they are saved to the other_annotations
and column_annotations
subdirectories, respectively, via saveObject
.
In the on-disk representation, no distinction is made between DataFrame and data.frame instances of x
.
Calling readDataFrame
will always produce a DFrame regardless of the class of x
.
library(S4Vectors)
df <- DataFrame(A=1:10, B=LETTERS[1:10])
tmp <- tempfile()
saveObject(df, tmp)
list.files(tmp, recursive=TRUE)
#> [1] "OBJECT" "_environment.json" "basic_columns.h5"