1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/saveDataFrame.R
\name{saveObject,DataFrame-method}
\alias{saveObject,DataFrame-method}
\alias{stageObject,DataFrame-method}
\alias{saveObject,data.frame-method}
\title{Save a DataFrame to disk}
\usage{
\S4method{saveObject}{DataFrame}(x, path, ...)
\S4method{saveObject}{data.frame}(x, path, ...)
}
\arguments{
\item{x}{A \linkS4class{DataFrame} or data.frame.}
\item{path}{String containing the path to a directory in which to save \code{x}.}
\item{...}{Additional named arguments to pass to specific methods.}
}
\value{
A named list containing the metadata for \code{x}.
\code{x} itself is written to a HDF5 file inside \code{path}.
Additional files may also be created inside \code{path} and referenced from the metadata.
}
\description{
Stage a DataFrame by saving it to a HDF5 file.
}
\details{
This method creates a \code{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 \code{other_columns} subdirectory inside \code{path} via \code{\link{saveObject}},
named after its zero-based positional index within \code{x}.
If \code{\link{metadata}} or \code{\link{mcols}} are present,
they are saved to the \code{other_annotations} and \code{column_annotations} subdirectories, respectively, via \code{\link{saveObject}}.
In the on-disk representation, no distinction is made between \linkS4class{DataFrame} and data.frame instances of \code{x}.
Calling \code{readDataFrame} will always produce a \linkS4class{DFrame} regardless of the class of \code{x}.
}
\examples{
library(S4Vectors)
df <- DataFrame(A=1:10, B=LETTERS[1:10])
tmp <- tempfile()
saveObject(df, tmp)
list.files(tmp, recursive=TRUE)
}
\author{
Aaron Lun
}
|