filter_demo: Filter data for given variable

Description Usage Arguments See Also Examples

View source: R/data-dive.R

Description

To be run from run_visual_dive. Applies a filter as needed based on the checked categories. R3 gets special treatment since it should only be missing in the first 5 years of data.

Usage

1
2
3
4
5
6
filter_demo(
  priv,
  var = "sex",
  var_select = c("Male", "Female"),
  var_all = c("Male", "Female")
)

Arguments

priv

data for one permission

var

name of variable for filtering

var_select

currently selted values of var

var_all

set of values that var can take

See Also

Other data dive functions: drop_state_code(), get_county_map_dive(), load_cust_samp(), plot_county_dive(), plot_dist(), plot_trend(), run_visual_dive(), set_nonres_county_na(), set_other_county_na(), summarize_trend()

Examples

1
2
3
4
5
6
7
library(dplyr)
data(hist_samp)
priv <- filter(hist_samp, priv == "all_sports")
count(priv, R3, year) %>% tidyr::spread(year, n)

priv <- filter_demo(priv, "R3", c("Renew", "Reactivate"))
count(priv, R3, year) %>% tidyr::spread(year, n)

southwick-associates/sadash documentation built on Jan. 6, 2022, 5:17 p.m.