qwrite {io} | R Documentation |
Data output
Description
This function writes an object to file in a specified format.
Usage
qwrite(x, file, type = NULL, mkpath = TRUE, symlink = TRUE, ...)
Arguments
x |
data object to write |
file |
filename (character or |
type |
data or file type |
mkpath |
whether to create parent directories (if they do not already exists) |
symlink |
whether to create a symlink to file with a simplified
file name (ignored if file is not a |
... |
other arguments passed to the underlying function |
Details
If type
is NULL
, the file type is inferred from
the file extension. If type
is NA
or if the file extension is
unavailable or unknown, type
is inferred from class(x)
.
Use io_supported
to check support for a file or data type.
Value
a data object (object type depends on the underlying function)
Examples
## Not run:
data(cars)
# write data to a TSV file
qwrite(cars, "cars.tsv")
# infer output type based on the class of the cars object
qwrite(as.matrix(cars), "cars.mtx", type=NA)
## End(Not run)