read_dir: Read In Multiple Files From a Directory

Description Usage Arguments Value Examples

View source: R/read_dir.R

Description

Read in multiple files from a directory and create a data.frame.

Usage

1
2
read_dir(path, pattern = NULL, doc.col = "document",
  all.files = FALSE, recursive = FALSE, ignore.case = FALSE, ...)

Arguments

path

Path to the directory.

pattern

An optional regular expression. Only file names which match the regular expression will be returned.

doc.col

A string naming the document columns (i.e., file names sans file extension).

all.files

Logical. If FALSE, only the names of visible files are returned. If TRUE, all file names will be returned.

recursive

Logical. Should the listing recurse into directories?

ignore.case

logical. If TRUE case in the pattern argument will be ignored.

...

Other arguments passed to read_document functions.

Value

Returns a data.frame with file names as a document column and content as a text column.

Examples

1
2
read_dir(system.file("docs/Maas2011/pos", package = "textreadr"))
read_dir(system.file("docs/Maas2011", package = "textreadr"), recursive=TRUE)

textreadr documentation built on Sept. 28, 2018, 5:09 p.m.