Learn R Programming

quanteda.tidy (version 0.4)

select.corpus: Subset docvars using their names and types

Description

Select (and optionally rename) document variables in a data frame, using a concise mini-language that makes it easy to refer to variables based on their name (e.g. a:f selects all columns from a on the left to f on the right). You can also use predicate functions like is.numeric to select variables based on their properties.

Usage

# S3 method for corpus
select(.data, ...)

Value

A corpus with the specified subset of document variables.

Arguments

.data

a quanteda object with document variables

...

<tidy-select> One or more unquoted expressions separated by commas. Variable names can be used as if they were positions in the data frame, so expressions like x:y can be used to select a range of variables.

Details

For an overview of selection features, see dplyr::select().

Examples

Run this code
data_corpus_inaugural %>%
  select(Party, Year) %>%
  summary(n = 5)

Run the code above in your browser using DataLab