setMeta: Function to access meta data for textmining objects

Description Usage Arguments Value Examples

View source: R/get_set_functions.R

Description

Function to access meta data for textmining objects

Usage

1
setMeta(x, parameter, value, i = 1)

Arguments

x

object to retrive document fe tmCorpus or tmTextDocument

parameter

name of metadata to be extracted

value

value of meta data to set

i

index

Value

returns i-th document of corpus x

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
corp <- tmCorpus(c("This is first document", "This is second"))
corp <- setMeta(corp, parameter = "language", "pl", 1)
getMeta(corp, parameter = "language", 1)
meta(corp, "title") <- c("T1","T2")
meta(corp, "title")

text <- tmTextDocument("Text document")
text <- setMeta(text, "language", "de")
getMeta(text, "language")
meta(text, "title") <- "New"
meta(text, "title")

parsed <- tmParsed(list(c("Parsed", "doc", "one"), c("Parsed", "two")))
parsed <- setMeta(parsed, parameter = "title",  "New1", 2)
getMeta(parsed, parameter = "title",  2)
meta(parsed, "title") <- c("T1", "T2")
meta(parsed, "title")

textmining documentation built on May 29, 2017, 8:27 p.m.