setDoc: Function to change documents for textmining objects

Description Usage Arguments Value Examples

Description

Function to change documents for textmining objects

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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)

textmining documentation built on May 2, 2019, 6:47 a.m.