Notes

Include some notes here about your assessment of the final validation.

knitr::opts_chunk$set(comment = NA)
library(tidyverse)
library(lubridate)
library(DBI)
library(salic)
library(salicprep)
source("../params.R")

Load Data

con <- dbConnect(RSQLite::SQLite(), db_production)
lic <- tbl(con, "lic") %>% collect()
cust <- tbl(con, "cust") %>% 
    select(cust_id, birth_year, sex) %>%
    collect()
sale <- tbl(con, "sale") %>% 
    select(cust_id, lic_id, year, dot, res) %>%
    collect()
dbDisconnect(con)

Hunters

hunt <- lic %>%
    filter(type %in% c("hunt", "combo")) %>%
    left_join(sale, by = "lic_id") %>%
    left_join(cust, by = "cust_id") %>%
    label_categories() %>%
    recode_agecat()

summary_initial(hunt)
plot_demo(hunt, c("sex", "agecat", "res"), trend = TRUE)

Anglers

fish <- lic %>%
    filter(type %in% c("fish", "combo")) %>%
    left_join(sale, by = "lic_id") %>%
    left_join(cust, by = "cust_id") %>%
    label_categories() %>%
    recode_agecat()

summary_initial(fish)
plot_demo(fish, c("sex", "agecat", "res"), trend = TRUE)

Dates

sale <- mutate_at(sale, vars(dot), "ymd")
summary_year_dot(sale, lastyr) %>% knitr::kable()


southwick-associates/lictemplate documentation built on Jan. 10, 2022, 6:44 p.m.