DataframeSource {tm}R Documentation

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.

Author(s)

Ingo Feinerer

See Also

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

Examples

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))

[Package tm version 0.5-10 Index]