qread {io}R Documentation

Data input

Description

This function reads a file in a specified format.

Usage

qread(file, type = NULL, ...)

Arguments

file

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

type

data or file type

...

other arguments passed to the underlying function

Details

If type is NULL, the file type is inferred from the file extension. Use io_supported to check support for a file or data type.

Value

a data object (type depends on the underlying function)

Examples

## Not run: 
data(cars)

# write data to an RDS file
qwrite(cars, "cars.rds")
# infer output type based on the class of the cars object
qwrite(cars, "cars.dfm", type=NA)

# read data back in
x1 <- qread("cars.rds")
# specify the type explicitly
x3 <- qread("cars.dfm", type="data.frame")

# read all files (with extension) in current directory
xs <- qread(".", pattern="cars")

## End(Not run)


[Package io version 0.3.2 Index]