Learn R Programming

textmining (version 0.0.1)

setDoc: Function to change documents for textmining objects

Description

Function to change documents for textmining objects

Usage

setDoc(x, doc, i = 1)

Arguments

x
text mining object tmCorpus or tmTextDocument
doc
element to be attached as content
i
index

Value

x with changed i-th document

Examples

Run this code
corp <- tmCorpus(c("This is first document", "This is second"))
corp <- setDoc(corp, "Changed doc", 1)
getDoc(corp, 1)
content(corp) <- c("Content 1", "Content 2")
content(corp)

text <- tmTextDocument("Text document new")
text <- setDoc(text, "Content no 1")
getDoc(text)
content(text)

parsed <- tmParsed(list(c("Parsed", "doc", "one"), c("Parsed", "two")))
parsed <- setDoc(parsed, c("Changed", "document"), 2)
getDoc(parsed, 2)
content(parsed) <- list(c("Changed", "document", "one"), c("Changed", "two"))
content(parsed)

Run the code above in your browser using DataLab