Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

DirSource

Directory Source


Description

Create a directory source.

Usage

DirSource(directory = ".",
          encoding = "",
          pattern = NULL,
          recursive = FALSE,
          ignore.case = FALSE,
          mode = "text")

Arguments

directory

A character vector of full path names; the default corresponds to the working directory getwd().

encoding

a character string describing the current encoding. It is passed to iconv to convert the input to UTF-8.

pattern

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

recursive

logical. Should the listing recurse into directories?

ignore.case

logical. Should pattern-matching be case-insensitive?

mode

a character string specifying if and how files should be read in. Available modes are:

""

No read. In this case getElem and pGetElem only deliver URIs.

"binary"

Files are read in binary raw mode (via readBin).

"text"

Files are read as text (via readLines).

Details

A directory source acquires a list of files via dir and interprets each file as a document.

Value

An object inheriting from DirSource, SimpleSource, and Source.

See Also

Source for basic information on the source infrastructure employed by package tm.

Encoding and iconv on encodings.

Examples

DirSource(system.file("texts", "txt", package = "tm"))

tm

Text Mining Package

v0.7-8
GPL-3
Authors
Ingo Feinerer [aut, cre] (<https://orcid.org/0000-0001-7656-8338>), Kurt Hornik [aut] (<https://orcid.org/0000-0003-4198-9911>), Artifex Software, Inc. [ctb, cph] (pdf_info.ps taken from GPL Ghostscript)
Initial release
2020-11-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.