read_file {connector}R Documentation

Read files based on the extension

Description

read_file() is the backbone of all read_cnt methods, where files are read from their source. The function is a wrapper around read_ext(), that controls the dispatch based on the file extension.

read_ext() controls which packages and functions are used to read the individual file extensions. Below is a list of all the pre-defined methods:

Usage

read_file(path, ...)

read_ext(path, ...)

## Default S3 method:
read_ext(path, ...)

## S3 method for class 'txt'
read_ext(path, ...)

## S3 method for class 'csv'
read_ext(path, delim = ",", ...)

## S3 method for class 'parquet'
read_ext(path, ...)

## S3 method for class 'rds'
read_ext(path, ...)

## S3 method for class 'sas7bdat'
read_ext(path, ...)

## S3 method for class 'xpt'
read_ext(path, ...)

## S3 method for class 'yml'
read_ext(path, ...)

## S3 method for class 'json'
read_ext(path, ...)

## S3 method for class 'xlsx'
read_ext(path, ...)

Arguments

path

character() Path to the file.

...

Other parameters passed on the functions behind the methods for each file extension.

delim

Single character used to separate fields within a record.

Value

the result of the reading function

Examples

# Read CSV file
temp_csv <- tempfile("iris", fileext = ".csv")
write.csv(iris, temp_csv, row.names = FALSE)
read_file(temp_csv)


[Package connector version 0.1.1 Index]