read_delim_multi: Read and bind multiple data files at once.

Description Usage Arguments Details Value Examples

Description

Wrapper around read_delim to read multiple files at once and return a single tibble where all files have been combined row-wise. For example, in a psychological experiment where one task is run repeatedly for multiple subjects, use this function to read all of their data into one fully long dataframe at once. As with read_csv and read_tsv, the read_*_multi versions are special cases of read_delim_multi for common types of flat file data, CSV and TSV.

Usage

1
2
3
4
5

Arguments

files

A character vector containing a series of paths to files.

...

other arguments passed on to read_delim.

Details

read_delim_multi requires all files to have the same file ending, and thus the same delimiter.

All functions first attempt to use bind_rows to combine data, in order to preserve column data types as rigorously as possible. If this fails, rbind.fill will instead be used to combine data, which may silently coerce some columns to character.

Value

A data frame, with file contents concatenated row-wise. Contains a column file with the file name of origin for each line of data.

Examples

1
2
3
4
5
6
7
## Not run: 
read_csv_multi(files = c("subject1.csv", "subject2.csv", "subject3.csv"))

these_files <- endsWith(list.files("path/to/data/folder"), ".csv")
read_csv_multi(these_files)

## End(Not run)

cu-psych-r-users/cuPsychRTools documentation built on July 25, 2019, 5:39 p.m.