qread: Data input

Description Usage Arguments Details Value Examples

View source: R/qread.R

Description

This function reads a file in a specified format.

Usage

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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)

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

Related to qread in io...