Load the Canadian Postsecondary Alcohol and Drug-use Survey (CPADS)
Source:R/datasets.R
morie_datasets_cpads.RdResolves a CPADS analysis frame from one of three sources:
Usage
morie_datasets_cpads(
offline = TRUE,
mode = c("datastore_search", "csv"),
limit = NULL,
q = NULL
)Arguments
- offline
Logical.
TRUE(default) prefers the bundled fixture for fast/CRAN-safe runs;FALSEfetches the live PUMF.- mode
Character; one of
"datastore_search"(default; queryable CKAN datastore endpoint, supportslimit/q) or"csv"(whole PUMF CSV download). Ignored whenoffline = TRUE.- limit
Integer or
NULL; row cap, forwarded todatastore_searchwhenmode = "datastore_search".NULLreturns the datastore default (100 rows).- q
Character or
NULL; free-text query forwarded todatastore_search(e.g.q = "title:jones"). Ignored formode = "csv".
Value
A data.frame carrying every CPADS PUMF column plus
morie's canonical analysis aliases (weight,
alcohol_past12m, heavy_drinking_30d, ebac_tot,
ebac_legal, cannabis_any_use, age_group, gender,
province_region, mental_health, physical_health).
Details
A pre-wrangled local RDS at
morie_cpads_contract()$expected_wrangled_path(only useful if you've already produced one), ORthe bundled 30-row real PUMF sample at
inst/extdata/cpads_pumf_synthetic.csv(whenoffline = TRUE, the default; carries all 394 raw PUMF columns plus the 11 morie canonical analysis aliases), ORthe live PUMF via the CKAN datastore_search API (default, supports
limit/q) or the full PUMF CSV (withmode = "csv"): https://open.canada.ca/data/dataset/736fa9b2-62e4-4e31-aea4-51869605b363/resource/d2639429-c304-45a6-90b3-770562f4d46d/download/cpads-2021-2022-pumf2.csv (whenoffline = FALSE).
CPADS is open data published by Health Canada / Statistics Canada (Open Government Licence – Canada). Aggregate dashboards at https://health-infobase.canada.ca/substance-use/reports/cpads/; PUMF user guide: https://open.canada.ca/data/dataset/736fa9b2-62e4-4e31-aea4-51869605b363/resource/a078e4c3-a910-4349-b00e-6ea0d31d391d/download/20212022-cpads-pumf-user-guide.pdf. Sister surveys (CSADS, CSUS, CTADS) are at https://health-infobase.canada.ca/substance-use/.
See also
morie_cpads_contract() for the canonical schema +
column map; morie_datasets_load_by_key() for catalog-wide
dispatch.