Checks that all columns required for the schema's survey_type are mapped
(non-NULL). Aborts with an informative cli_abort() listing each missing
column and its table.
Arguments
- schema
A
creel_schemaobject created bycreel_schema().
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_interview_catch(),
prep_interviews_trips()
Examples
# A schema names the source columns for each table its survey type needs.
schema <- creel_schema(
survey_type = "instantaneous",
interview_uid_col = "interview_id",
date_col = "date",
trip_status_col = "trip_status",
effort_col = "hours_fished",
catch_col = "catch_total",
catch_uid_col = "catch_id",
species_col = "species",
catch_count_col = "count",
catch_type_col = "catch_type",
length_uid_col = "length_id",
length_mm_col = "length",
length_type_col = "length_type",
count_time_col = "count_time",
bank_anglers_col = "bank_anglers",
count_col = "angler_count"
)
validate_creel_schema(schema)
# An incomplete schema is refused here rather than failing later at a join.
try(validate_creel_schema(creel_schema(survey_type = "instantaneous")))
#> Error in validate_creel_schema(creel_schema(survey_type = "instantaneous")) :
#> creel_schema validation failed for survey_type "instantaneous":
#> ✖ date (interviews table) is missing
#> ✖ catch (interviews table) is missing
#> ✖ effort (interviews table) is missing
#> ✖ trip_status (interviews table) is missing
#> ✖ date (counts table) is missing
#> ✖ count (counts table) is missing
#> ✖ catch_uid (catch table) is missing
#> ✖ interview_uid (catch table) is missing
#> ✖ species (catch table) is missing
#> ✖ catch_count (catch table) is missing
#> ✖ catch_type (catch table) is missing
#> ✖ length_uid (lengths table) is missing
#> ✖ interview_uid (lengths table) is missing
#> ✖ species (lengths table) is missing
#> ✖ length_mm (lengths table) is missing
#> ✖ length_type (lengths table) is missing
