Learn R Programming

quanteda (version 0.8.4-2)

texts: get corpus texts

Description

Get the texts in a quanteda corpus object, with grouping options

Usage

texts(x, ...)

## S3 method for class 'corpus': texts(x, groups = NULL, ...)

## S3 method for class 'corpusSource': texts(x, groups = NULL, ...)

Arguments

x
A quanteda corpus object
...
not currently used
groups
character vector containing the names of document variables for aggregating documents

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
str(texts(ie2010Corpus, groups = "party"))

Run the code above in your browser using DataLab