Learn R Programming

tm (version 0.5-9.1)

readPlain: Read In a Text Document

Description

Return a function which reads in a text document without knowledge about its internal structure and possible available metadata.

Usage

readPlain(...)

Arguments

...
Arguments for the generator function.

Value

  • A function with the signature elem, language, id:
  • elemA list with the named element content which must hold the document to be read in.
  • languageA character vector giving the text's language.
  • idA character vector representing a unique identification string for the returned text document.
  • The function returns a PlainTextDocument representing content.

Details

Formally this function is a function generator, i.e., it returns a function (which reads in a text document) with a well-defined signature, but can access passed over arguments via lexical scoping. This is especially useful for reader functions for complex data structures which need a lot of configuration options.

See Also

getReaders to list available reader functions.

Examples

Run this code
docs <- c("This is a text.", "This another one.")
vs <- VectorSource(docs)
elem <- getElem(stepNext(vs))
(result <- readPlain()(elem, "en", "id1"))
meta(result)

Run the code above in your browser using DataLab