set_other_county_na: Set cust$county_fips to missing if from another state

Description Usage Arguments See Also Examples

View source: R/data-dive.R

Description

We may have counties from entirely different states attached to the customer table and we don't want these in the data dive

Usage

1
2
3
4
5

Arguments

cust

customer table

state

2-character state abbreviation

county_map

function to use for pulling a list of counties in state

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(dplyr)

## Not run: 
db_history <- "E:/SA/Data-production/Data-Dashboards/IA/history.sqlite3"  
db_license <- "E:/SA/Data-production/Data-Dashboards/IA/license.sqlite3"
cust_samp <- left_join(
    load_cust_samp(db_history, 2006:2018),
    load_cust(db_license)
)
count(cust_samp, county_fips)
set_other_county_na(cust_samp, "IA") %>% count(county_fips)

## End(Not run)

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