Learn R Programming

textreadr (version 0.5.1)

read_dir: Read In Multiple Files From a Directory

Description

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

Usage

read_dir(path, pattern = NULL, doc.col = "document", all.files = FALSE,
  recursive = 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?
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

Run this code
read_dir(system.file("docs/Maas2011/pos", package = "textreadr"))
read_dir(system.file("docs/Maas2011", package = "textreadr"), recursive=TRUE)

Run the code above in your browser using DataLab