
Standardize long catch-table rows for interview-based workflows
Source:R/prep-interviews.R
prep_interview_catch.RdConverts a long-format catch table into a canonical tibble for downstream use
with add_catch(). The helper standardizes the interview linkage field,
species field, numeric catch counts, and normalized catch-type values while
keeping the data in long form.
The returned table always contains canonical columns:
interview_uid, species, count, and catch_type.
Arguments
- data
A data frame in long format: one row per interview/species/catch-type combination.
- interview_uid
Tidy selector for the interview linkage column.
- species
Tidy selector for the species code or name column.
- count
Tidy selector for the numeric catch count column.
- catch_type
Tidy selector for the catch fate column. Values are normalized to lowercase.
See also
Other "Survey Design":
add_catch(),
add_counts(),
add_interviews(),
add_lengths(),
add_sections(),
as_creel_svydesign(),
as_hybrid_svydesign(),
compute_angler_effort(),
compute_effort(),
creel_design(),
creel_schema(),
creel_vocabulary(),
derive_angler_count(),
est_effort_camera(),
impute_camera_counts(),
mean_party_size(),
prep_counts_boat_party(),
prep_counts_daily_effort(),
prep_interviews_trips(),
validate_creel_schema()
Examples
raw <- data.frame(
iid = c("i1", "i1", "i2"),
sp = c("walleye", "walleye", "bass"),
n = c(5, 2, 1),
fate = c("Caught", "HARVESTED", "released")
)
prep_interview_catch(raw, interview_uid = iid, species = sp,
count = n, catch_type = fate)
#> # A tibble: 3 × 4
#> interview_uid species count catch_type
#> <chr> <chr> <dbl> <chr>
#> 1 i1 walleye 5 caught
#> 2 i1 walleye 2 harvested
#> 3 i2 bass 1 released