Learn R Programming

quanteda (version 0.9.2-0)

subset.corpus: extract a subset of a corpus

Description

Returns subsets of a corpus that meet certain conditions, including direct logical operations on docvars (document-level variables). Works just like the normal subset command but for corpus objects.

Usage

## S3 method for class 'corpus':
subset(x, subset, select, ...)

Arguments

x
corpus object to be subsetted.
subset
logical expression indicating elements or rows to keep: missing values are taken as false.
select
expression, indicating the attributes to select from the corpus
...
not used

Value

  • corpus object

See Also

select

Examples

Run this code
summary(subset(inaugCorpus, Year>1980))
summary(subset(inaugCorpus, Year>1930 & President=="Roosevelt", select=Year))

Run the code above in your browser using DataLab