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

readDataframe

Read In a Text Document from a Data Frame


Description

Read in a text document from a row in a data frame.

Usage

readDataframe(elem, language, id)

Arguments

elem

a named list with the component content which must hold a data frame with rows as the documents to be read in. The names of the columns holding the text content and the document identifier must be "text" and "doc_id", respectively.

language

a string giving the language.

id

Not used.

Value

A PlainTextDocument representing elem$content.

See Also

Reader for basic information on the reader infrastructure employed by package tm.

Examples

docs <- data.frame(doc_id = c("doc_1", "doc_2"),
                   text = c("This is a text.", "This another one."),
                   stringsAsFactors = FALSE)
ds <- DataframeSource(docs)
elem <- getElem(stepNext(ds))
result <- readDataframe(elem, "en", NULL)
inspect(result)
meta(result)

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.