Every warning tidycreel raises is also recorded on the object the call
returns, so it can be read back after it has scrolled past. A design keeps
the warnings raised by creel_design(), each add_*() step and
adjust_nonresponse(); an
estimate keeps the warnings raised while it was computed, including those
from a rate a total computes internally.
Value
A data frame with one row per warning, in the order raised:
- id
Position in the session's sequence of tidycreel warnings.
- class
Its own class:
creel_warning_<fact>, or for a tier-3 messagecreel_message_<fact>.- tier
1, 2 or 3, as above.
- fn
The function that raised it.
- message
The text of the warning or message, without formatting.
Zero rows when nothing was raised.
Details
Each warning has a tier, as listed in creel_warnings:
- 1
The estimate may be wrong: units, a missing period length, sections or cells left out of a total, an SE that ignores the design.
- 2
Data quality or precision: small samples, exclusions, short trips, thin cells.
- 3
Information: an argument with no effect, an estimator choice. Raised as a message, not a warning, and recorded all the same.
A warning is recorded even when the caller handles or muffles it. A
data-quality warning (tier 2) prints only the first time it is raised on a
design; its repeats are recorded here without printing (see
creel_warnings). A first occurrence the caller muffles, with
suppressWarnings() or a handler, still counts as that one print: later
calls on the same design do not print it. Warnings raised by other
packages (survey, lme4) are not recorded.
See also
creel_warnings for every class and its meaning.
Examples
design <- creel_design(example_calendar, date = date, strata = day_type)
design <- add_counts(design, example_counts)
# The party-size warning is handled for this one call, so it does not
# print, but the design still records it.
design <- withCallingHandlers(
add_interviews(design, example_interviews,
catch = catch_total, effort = hours_fished, trip_status = trip_status
),
creel_warning_no_party_size = function(w) invokeRestart("muffleWarning")
)
#> ℹ Added 22 interviews: 17 complete (77%), 5 incomplete (23%)
get_warnings(design)
#> id class tier fn
#> 1 124 creel_warning_no_party_size 1 add_interviews
#> message
#> 1 ! No `n_anglers` provided — assuming 1 angler per interview.\nℹ Pass `n_anglers = <column>` to use actual party sizes for angler-hour\n normalization.\nℹ If the interviews really are one angler each, pass `n_anglers = 1` to state\n that and silence this warning.
