Learn R Programming

quanteda (version 1.3.13)

metadoc: Get or set document-level meta-data

Description

Get or set document-level meta-data. Document-level meta-data are a special type of docvars, meant to contain information about documents that would not be used as a "variable" for analysis. An example could be the source of the document, or notes pertaining to its transformation, copyright information, etc.

Document-level meta-data differs from corpus-level meta-data in that the latter pertains to the collection of texts as a whole, whereas the document-level version can differ with each document.

Usage

metadoc(x, field = NULL)

metadoc(x, field = NULL) <- value

Arguments

x

a corpus object

field

character, the name of the metadata field(s) to be queried or set

value

the new value of the new meta-data field

Value

For texts, a character vector of the texts in the corpus.

For texts <-, the corpus with the updated texts.

See Also

metacorpus

Examples

Run this code
# NOT RUN {
mycorp <- corpus_subset(data_corpus_inaugural, Year > 1990)
summary(mycorp, showmeta = TRUE)
metadoc(mycorp, "encoding") <- "UTF-8"
metadoc(mycorp)
metadoc(mycorp, "language") <- "english"
summary(mycorp, showmeta = TRUE)
# }

Run the code above in your browser using DataLab