| subset_elections | R Documentation |
Extracts a subset of races from an existing "ei_summary" object without
reloading or recomputing from raw data. Vote counts remain exactly as in
the original object because the universe is unchanged.
subset_elections(x, elections)
## S3 method for class 'ei_summary'
x[elections]
x |
An |
elections |
Character vector of race codes to retain. Must be a
subset of |
The [ operator is also available as a shorthand: x[elections] is
equivalent to subset_elections(x, elections).
A new "ei_summary" object restricted to elections.
obj3 <- ei_summary(c("PRE", "USS", "HOS3"))
# Equivalent ways to extract a 2-race subset
obj2 <- subset_elections(obj3, c("PRE", "USS"))
obj2 <- obj3[c("PRE", "USS")]
obj1 <- obj3["PRE"] # single race: no joint array
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.