mountainMath / cmhc

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

Rent ranges dimension #8

Closed bdbmax closed 1 year ago

bdbmax commented 1 year ago

Hello again!

When getting the vacancy rates in the rent ranges dimension, the Rent Ranges column gets tweaked into (I believe) unwanted duplicated rows, and unreadable values.

 cmhc::get_cmhc(survey = "Rms", 
                            series = "Vacancy Rate", 
                            dimension = "Rent Ranges",
                            breakdown = "Survey Zones", 
                            geo_uid = "24462")
New names:                                                                                                                      
• `"$1` -> `"$1...6`
• `"$1` -> `"$1...10`
• `"$1` -> `"$1...14`
# A tibble: 390 × 7
   `Survey Zones`                    `Rent Ranges`    Value Quality     Censu…¹ Survey Series
   <chr>                             <fct>            <dbl> <fct>       <chr>   <chr>  <chr> 
 1 Downtown Montréal/Îles-des-Soeurs "Less Than $750"  NA   NA          2016    Rms    Vacan…
 2 Downtown Montréal/Îles-des-Soeurs "$750 - $999"      5.1 Fair (Use … 2016    Rms    Vacan…
 3 Downtown Montréal/Îles-des-Soeurs "\"$1...6"        NA   NA          2016    Rms    Vacan…
 4 Downtown Montréal/Îles-des-Soeurs "000 - $1"        NA   NA          2016    Rms    Vacan…
 5 Downtown Montréal/Îles-des-Soeurs "249\""            4.6 Good        2016    Rms    Vacan…
 6 Downtown Montréal/Îles-des-Soeurs "\"$1...10"        7.9 NA          2016    Rms    Vacan…
 7 Downtown Montréal/Îles-des-Soeurs "250 - $1"        NA   NA          2016    Rms    Vacan…
 8 Downtown Montréal/Îles-des-Soeurs "499\""           NA   NA          2016    Rms    Vacan…
 9 Downtown Montréal/Îles-des-Soeurs "\"$1...14"        6.3 NA          2016    Rms    Vacan…
10 Downtown Montréal/Îles-des-Soeurs "500 +\""         NA   NA          2016    Rms    Vacan…
# … with 380 more rows, and abbreviated variable name ¹​`Census geography`
# ℹ Use `print(n = ...)` to see more rows
Warning message:
Problem while computing `Value = parse_numeric(.data$Value)`.
ℹ NAs introduced by coercion 

Let me know if any more information is needed, Thanks again!

bdbmax commented 1 year ago

Please look at the https://github.com/mountainMath/cmhc/pull/9 pull request on this subject. The comma used in the rent ranges ($d,ddd) was causing the noise, as the categories are split by the comma separating them. Switching the big mark to a dot before the split and back to a comma afterwards solves this issue.