read_dir: Read in a directory of files

Description Usage Arguments Value Examples

View source: R/Import_Functions.R

Description

This function reads in all files from a directory using the choosen import function. Use the 'pattern' argument to specificy a set of files, or a single file type. If collapse = TRUE bind_rows is used to match column names and bind the imported data into a single object.

Usage

1
2
read_dir(dir = getwd(), pattern = NULL, collapse = TRUE, fun = read.csv,
  ...)

Arguments

dir

A directory that contains your data files, defaults to the working directory

pattern

A pattern to match filenames as in list.files

collapse

A logical argument, when true a single object is returned, when false an object is returned for each file. defaults to TRUE

fun

The function to use to read in the files, defaults to read.csv

...

Additional arguments to pass to the input method

Value

When collapse = T a single object matching the output class of fun is returned. When collapse = F a list of objects matching the output class of fun is returned with names corresponded to the names of the imported files

Examples

1

jpshanno/ecoflux documentation built on Nov. 4, 2018, 11:47 p.m.