VectorSource: Vector Source

Description Usage Arguments Details Value See Also Examples

Description

Create a vector source.

Usage

1

Arguments

x

A vector giving the texts.

Details

A vector source interprets each element of the vector x as a document.

Value

An object inheriting from VectorSource, SimpleSource, and Source.

See Also

Source for basic information on the source infrastructure employed by package tm.

Examples

1
2
3
docs <- c("This is a text.", "This another one.")
(vs <- VectorSource(docs))
inspect(VCorpus(vs))

Example output

Loading required package: NLP
$encoding
[1] ""

$length
[1] 2

$position
[1] 0

$reader
function (elem, language, id) 
{
    if (!is.null(elem$uri)) 
        id <- basename(elem$uri)
    PlainTextDocument(elem$content, id = id, language = language)
}
<environment: namespace:tm>

$content
[1] "This is a text."   "This another one."

attr(,"class")
[1] "VectorSource" "SimpleSource" "Source"      
<<VCorpus>>
Metadata:  corpus specific: 0, document level (indexed): 0
Content:  documents: 2

[[1]]
<<PlainTextDocument>>
Metadata:  7
Content:  chars: 15

[[2]]
<<PlainTextDocument>>
Metadata:  7
Content:  chars: 17

tm documentation built on May 2, 2019, 2:43 a.m.