Every error, warning, and message this package signals carries a
class, so tryCatch() and withCallingHandlers() can react to
exactly the situation they mean to and nothing else, e.g.
tryCatch(read_brfss(2023), brfssdata_download_error = \(e) NULL) or
suppressWarnings(..., classes = "brfssdata_break_warning").
quiet = TRUE never hides a signal about what the data mean; it
suppresses progress and housekeeping output only. To silence a
specific analytical note, suppress its class, e.g.
suppressMessages(read_brfss(2021:2022, vars = "_DRNKWK1"), classes = "brfssdata_rename_note").
Errors
brfssdata_bad_years_argyearsis not a vector of whole survey years.brfssdata_bad_yearA requested year is not among the published releases.
brfssdata_no_dataThe data manifest could not be read or lists no published years.
brfssdata_bad_vars_argvarsis not a character vector of variable names.brfssdata_bad_varA requested variable does not exist in the requested years.
brfssdata_bad_states_argstatesis not a vector of FIPS codes, postal abbreviations, or jurisdiction names.brfssdata_bad_stateA value in
statesmatches no BRFSS jurisdiction; see brfss_states.brfssdata_bad_patternpatterninbrfss_vars()is not a valid regular expression.brfssdata_bad_weightweightinbrfss_design()is malformed, requested outside the weight's published span, absent from a requested year, or carries values that are not positive and finite.brfssdata_unrecognized_weightweightinbrfss_design()names a column that is not one of CDC's final analysis weights andunsafe_weight = TRUEwas not set. Also carriesbrfssdata_bad_weight, so one handler catches every weight refusal.brfssdata_bad_bool_argA
TRUE/FALSEargument received something else,NAincluded. Each flag also raises a class of its own on one pattern,brfssdata_bad_<argument>_arg:naraisesbrfssdata_bad_na_arg, and likewise fordownload,quiet,refresh,verify,catalogs,allow_break,pool_weights, andunsafe_weight. One handler on the shared class catches them all.brfssdata_bad_labels_arglabelsis something other thanTRUE,FALSE, or"both".brfssdata_bad_n_argninprint.brfss_codebook()is not a single positive number.brfssdata_bad_optionoptions(brfssdata.lonely_psu)is not a single string,options(brfssdata.module_weight_check)is notTRUEorFALSE, oroptions(brfssdata.cache_dir)is not a single non-empty path to a directory.brfssdata_bad_design_varA design variable (era weight,
_STSTR,_PSU) is absent or carries missing or invalid values, so no valid design can be built; for a final analysis weight this points at a damaged file.brfssdata_no_eligible_rowsNo rows are left to build a survey design: a
statesfilter, or the domain of a user-suppliedweight, emptied the frame.read_brfss()still returns the zero-row tibble, which is a usable answer; a zero-row survey design is not constructible.brfssdata_break_errorThe requested years span the 2011 redesign and
allow_break = TRUEwas not set.brfssdata_not_cacheddownload = FALSEwas set and the needed file is not in the cache.brfssdata_download_errorA download failed. Also the parent class of
brfssdata_checksum_error, so one handler catches both.brfssdata_checksum_errorA downloaded file did not match the manifest's sha256 after a retry; nothing was cached.
brfssdata_cache_unwritableThe cache directory could not be created, or exists but cannot be written to, so no download can land: a local permission problem, named as one instead of being reported as a network failure. Also carries
brfssdata_download_error, so the metadata lookups' bundled fallback still applies.brfssdata_corrupt_cacheA cached file is unreadable (typically a corrupted download from before verification); the message names the file and the
brfss_cache_clear()remedy.brfssdata_wrong_year_cacheA cached file does not hold the survey year its name promises (a hand-copied or damaged cache); the message says what each such file really holds. Also carries
brfssdata_corrupt_cache, so one handler covers both.brfssdata_duckdb_versionThe installed duckdb is older than the version this package requires, so the argument that keeps DuckDB from writing to the home directory is unavailable; the message names the required and the found version.
brfssdata_type_conflictA requested column is stored as text in some requested years' files and as a number in others, so combining them would silently corrupt values; usually stale cached files mixed with current releases, with the
brfss_cache_clear()remedy named.
Warnings
brfssdata_break_warningPooling across the 2011 redesign with
allow_break = TRUE.brfssdata_intermediate_weight_warningweightinbrfss_design()names an intermediate stage of CDC's weighting pipeline (e.g._LLCPWT2, the truncated pre-raking design weight), requested deliberately viaunsafe_weight = TRUE.brfssdata_unsafe_weight_warningweightinbrfss_design(), requested viaunsafe_weight = TRUE, names a column that is neither a final analysis weight nor a known pipeline stage; the estimates are calibrated to nothing.brfssdata_module_weight_warningA requested analysis variable has data almost only where a module weight (
_CLLCPWTand kin) is non-missing, but the design uses a full-sample weight: very likely a module analysis under the wrong weight. State-optional modules that CDC assigns to the core weight are the legitimate exception. Disable withoptions(brfssdata.module_weight_check = FALSE).brfssdata_pooled_states_warningPooled years differ in state participation, so totals mix coverage. Participation is counted over the rows a user-supplied
weightcovers, the population the design actually estimates, not over the whole file.brfssdata_empty_year_warningA requested year contributed no rows to a pooled design (a
statesfilter, or the domain of a user-suppliedweight, emptied it), so pooled weights divide by the contributing years only and totals estimate an average contributing year.brfssdata_label_drift_warningLabel wording for a variable changed meaning (not just formatting) across the requested years, so it kept CDC's numeric codes instead of converting to a factor; read the years separately if each year's own wording is wanted.
brfssdata_na_coverage_warningna = TRUErecoded nothing in a requested year, either because no value-label catalog exists for it (years before 1998) or because the catalog covers none of the loaded variables there: estimates over that year still contain CDC's don't-know and refused codes.brfssdata_state_coverage_warningA jurisdiction requested via
statesis absent from a requested year's file, so estimates for that year cover the remaining states only.
Messages
brfssdata_cache_noteCache lifecycle notes: directory created, files removed by
brfss_cache_clear(), a size-mismatched or checksum-failing cached file re-downloaded, a stale catalog refreshed, or thebrfss_download()summary.brfssdata_download_noteA survey year is being downloaded (once, then cached).
brfssdata_manifest_noteThe manifest or a catalog could not be refreshed; a cached or bundled copy was used.
brfssdata_lonely_psu_noteThe once-per-session note that
survey.lonely.psuwas set to"adjust".brfssdata_design_spec_noteThe specification of the design just built, stated the way a Stata log would (weight, strata, PSU term, pooling divisor; one
svysetline per era weight when pooling crosses 2011), for cross-checking against a coauthor'ssvyset. Suppressed byquiet = TRUE.brfssdata_unverified_noteAn asset was downloaded without checksum verification (the available manifest carries no hash for it).
brfssdata_na_notena = TRUEset missing-type codes toNA; the counts and thebrfss_missing_codes()audit trail.brfssdata_na_coverage_notena = TRUEwas requested for a year the value-label catalog covers only partially (1998 covers under a quarter of its file's variables), so codes in the uncatalogued variables passed through unchanged. Years with no catalog at all raisebrfssdata_na_coverage_warninginstead.brfssdata_weight_subset_noteA user-supplied
weightinbrfss_design()is missing on some rows (a module weight covers only its module's records); those rows were dropped, per CDC's module-analysis guidance.brfssdata_empty_resultA metadata lookup (
brfss_vars(),brfss_labels(),brfss_crosswalk(),brfss_year_info()) matched nothing. Frombrfss_vars()the message also suggests near misses: close names and labels, order-blind multi-word matches, and matches confined to other years.brfssdata_partial_match_noteSome requested variables in
brfss_labels()orbrfss_crosswalk()matched nothing while others matched, so the returned rows cover the matching variables only. Absence can be legitimate: continuous variables have no label entries, and most variables belong to no rename family.brfssdata_full_load_noteread_brfss()is loading every column becausevarswas not given;brfss_design()passesvarsthrough and inherits it.brfssdata_rename_noteA requested variable is empty in years a sibling generation from the rename crosswalk covers; see
brfss_crosswalk().brfssdata_case_match_notevarsmatched columns case-insensitively; the note pairs each requested spelling with the CDC-canonical column name the returned data actually use. Suppressed byquiet = TRUE.brfssdata_duplicate_label_notelabels = TRUEkept CDC's numeric codes for variables whose format gives several codes the same label, which a factor would merge into one level.brfssdata_bundled_fallback_noteA metadata lookup was served from the snapshot bundled with the package (frozen at release) because nothing newer was cached and no download was possible.