qwrite: Data output

Description Usage Arguments Details Value Examples

View source: R/qwrite.R

Description

This function writes an object to file in a specified format.

Usage

1
qwrite(x, file, type = NULL, mkpath = TRUE, symlink = TRUE, ...)

Arguments

x

data object to write

file

filename (character or filenamer::filename), a readable text-mode connection (for some types), or path to existing directory

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 filename object); an existing file will not be overwritten but an existing symlink will be

...

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

1
2
3
4
5
6
7
8
9
## 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)

io documentation built on Dec. 18, 2019, 1:39 a.m.

Related to qwrite in io...