Learn R Programming

tm (version 0.5-9.1)

DataframeSource: Data Frame Source

Description

Constructs a source from a data frame.

Usage

DataframeSource(x, encoding = "unknown")

Arguments

x
A data frame holding the texts.
encoding
encoding to be assumed for input strings. It is used to mark character strings as known to be in Latin-1 or UTF-8: it is not used to re-encode the input.

Value

  • An object of class DataframeSource which extends the class Source representing a data frame interpreting each row as a document.

See Also

getSources to list available sources. Encoding on encodings in R.

Examples

Run this code
docs <- data.frame(docs = c("This is a text.", "This another one."),
                   row.names = c("Text 1", "Text 2"))
(ds <- DataframeSource(docs))
inspect(Corpus(ds))

Run the code above in your browser using DataLab