mountainMath / cancensus

R wrapper for calling CensusMapper APIs
https://mountainmath.github.io/cancensus/index.html
Other
82 stars 15 forks source link

Some CMAs and their provincial sub-parts have the same population values #199

Open QU4N7UM opened 1 year ago

QU4N7UM commented 1 year ago

In the 2021 dataset, the 4 CMAs that share a provincial border between 2 provinces (for example GeoUID 505 and its sub-parts 35505 (Ontario part) and 24505 (Quebec part)) all have the same Population values while, I think, we can actually get their respectives (sub) values in StatCan, am I mistaking?

For info, the 4 CMAs in question are Campbellton(GeoUID 330), Hawkesbury (GeoUID 502), Lloydminster (GeoUID 840), and Ottawa - Gatineau (GeoUID 505).

mountainMath commented 1 year ago

Thanks for flagging, that's a bug. Will investigate and fix. In the meantime, you can get the accurate population by querying the census vector

cancensus::get_census("2021",regions=list(CMA=c("35505","505","24505")),vectors=c("v_CA21_1")) |> 
  select(GeoUID,`Region Name`,`v_CA21_1: Population, 2021`)
# A tibble: 3 × 3
  GeoUID `Region Name`                                              `v_CA21_1: Population, 2021`
  <chr>  <fct>                                                                             <dbl>
1 24505  Ottawa - Gatineau (partie du Québec / Quebec part) (B)                           353293
2 35505  Ottawa - Gatineau (Ontario part / partie de l'Ontario) (B)                      1135014
3 505    Ottawa - Gatineau (B)                                                           1488307
QU4N7UM commented 1 year ago

Thanks a bunch!