Maps angler zip codes to county using the zipcodeR package, then counts and computes the percent of interviews by county. NA or unmappable zip codes appear as an explicit "Unknown" row.
Arguments
- design
A
creel_designobject with interviews attached viaadd_interviews.- zip_col
Name of the interview column holding the angler zip code. Defaults to
"zip_code".
Value
A data.frame with class
c("creel_summary_county", "data.frame") and columns:
county (character), n (integer), pct (numeric,
1 decimal). NA or unmappable zip codes appear as "Unknown".
Details
Interview-based summary, not pressure-weighted. Requires the
zipcodeR package (listed in Suggests). No state filter is
applied; out-of-state anglers receive their actual county name. NA or
unmappable zip codes appear as "Unknown" for data quality visibility.
Sort order: "Unknown" last; remaining rows sorted by n descending.
See also
Other "Reporting & Diagnostics":
adjust_nonresponse(),
check_completeness(),
compare_variance(),
flag_outliers(),
season_summary(),
standardize_species(),
summarize_boat_composition(),
summarize_by_angler_type(),
summarize_by_day_type(),
summarize_by_method(),
summarize_by_species_sought(),
summarize_by_trip_length(),
summarize_by_zip(),
summarize_cws_rates(),
summarize_hws_rates(),
summarize_length_freq(),
summarize_refusals(),
summarize_successful_parties(),
summarize_trips(),
summary.creel_estimates(),
tidy.creel_estimates(),
validate_creel_data(),
validate_design(),
validate_incomplete_trips(),
validation_report(),
write_estimates()
Examples
data(example_calendar)
data(example_interviews)
# The shipped interviews carry no zip code, so add one to demonstrate the
# mapping. Two NAs are left in on purpose: an unmappable zip is reported as
# "Unknown" rather than dropped.
interviews_zip <- example_interviews
interviews_zip$zip_code <- rep(
c("68502", "68508", NA), length.out = nrow(interviews_zip)
)
design <- creel_design(example_calendar, date = date, strata = day_type)
design <- add_interviews(design, interviews_zip,
catch = catch_total, effort = hours_fished, harvest = catch_kept,
trip_status = trip_status
)
#> Warning: ! No `n_anglers` provided — assuming 1 angler per interview.
#> ℹ Pass `n_anglers = <column>` to use actual party sizes for angler-hour
#> normalization.
#> ℹ If the interviews really are one angler each, pass `n_anglers = 1` to state
#> that and silence this warning.
#> ℹ Added 22 interviews: 17 complete (77%), 5 incomplete (23%)
summarize_by_county(design)
#> county n pct
#> 1 Lancaster County 15 68.2
#> 2 Unknown 7 31.8
