corpus_subset: Extract a subset of a corpus

Description Usage Arguments Value See Also Examples

Description

Returns subsets of a corpus that meet certain conditions, including direct logical operations on docvars (document-level variables). corpus_subset functions identically to subset.data.frame, using non-standard evaluation to evaluate conditions based on the docvars in the corpus.

Usage

1
corpus_subset(x, subset, select, ...)

Arguments

x

corpus object to be subsetted

subset

logical expression indicating the documents to keep: missing values are taken as false

select

expression, indicating the docvars to keep

...

not used

Value

corpus object, with a subset of documents (and docvars) selected according to arguments

See Also

subset.data.frame

Examples

1
2
3
summary(corpus_subset(data_corpus_inaugural, Year > 1980))
summary(corpus_subset(data_corpus_inaugural, Year > 1930 & President == "Roosevelt", 
                      select = Year))

quanteda/quanteda documentation built on June 15, 2019, 8:36 a.m.