Learn R Programming

quanteda (version 0.9.7-17)

docnames: get or set document names

Description

Get or set the document names from a corpus or a document-feature matrix. of the dfm object.

Usage

docnames(x)
"docnames"(x)
docnames(x) <- value
"docnames"(x)

Arguments

x
the object with docnames
value
a character vector of the same length as x

Value

docnames returns a character vector of the document namesdocnames <- assigns new values to the document names of a corpus. (Does not work for dfm objects, whose document names are fixed.)

Examples

Run this code
# query the document names of the inaugural speech corpus
docnames(inaugCorpus) <- paste("Speech", 1:ndoc(inaugCorpus), sep="")

# reassign the document names of the inaugural speech corpus
docnames(inaugCorpus) <- paste("Speech", 1:ndoc(inaugCorpus), sep="")

# query the document names of a dfm
docnames(dfm(inaugTexts[1:5]))

Run the code above in your browser using DataLab