mountainMath / cmhc

Wrapper for hack into CMHC data
Other
18 stars 5 forks source link

Column name variability - MET_CODE versus METCODE #12

Open daniel-simeone opened 1 year ago

daniel-simeone commented 1 year ago

The function get_cmhc_geography appears to have differerent column names for the METCODE depending on the level of geography selected. The ZONE level is called MET_CODE while the MET level is called METCODE. The latter looks like it might be hardcoded in the internal function census_to_cmhc_geocode, while the former may come from the gdb files.

library(tidyverse)
library(cmhc)
get_cmhc_geography("ZONE") %>%  select(starts_with("MET") )
get_cmhc_geography("MET") %>%    select(starts_with("MET") )

image

mountainMath commented 1 year ago

Unfortunately, this is the result of inconsistent coding by CMHC. These two calls pull two different layers straight from the same gdb file that was provided by CMHC. Inconsistent coding is an issue throughout when working with CMHC data, I will think about how to best shield users from this by adopting a consistent naming conventions and making necessary changes within the package before returning data to users.

This is related to https://github.com/mountainMath/cmhc/issues/10.