Learn R Programming

quanteda (version 0.7.2-1)

texts: get or set corpus texts

Description

Get or replace the texts in a quanteda corpus object.

Usage

texts(corp)

texts(corp) <- value

Arguments

corp
A quanteda corpus object
value
character vector of the new texts

Value

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

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

Examples

Run this code
texts(inaugCorpus)[1]
sapply(texts(inaugCorpus), nchar)  # length in characters of the inaugual corpus texts

## this doesn't work yet - need to overload `[` for this replacement function
# texts(inaugTexts)[55] <- "GW Bush's second inaugural address, the condensed version."

Run the code above in your browser using DataLab