Skip to content

Commit

Permalink
Remove legacy ccao::vars_dict attributes from README.Rmd code (#4)
Browse files Browse the repository at this point in the history
* Remove legacy ccao::vars_dict attributes from README.Rmd code

* Lint README.Rmd

* Simplify res_params assignment in README.Rmd
  • Loading branch information
jeancochrane authored Oct 13, 2023
1 parent 5b5732d commit fc33def
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
36 changes: 19 additions & 17 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,27 @@ Because our office (mostly) cannot observe individual condo unit characteristics
library(dplyr)
library(tidyr)
library(yaml)
params <- read_yaml("params.yaml")
condo_params <- read_yaml("params.yaml")
condo_preds <- condo_params$model$predictor$all
res_params <- read_yaml(
"https://raw.githubusercontent.com/ccao-data/model-res-avm/master/params.yaml"
)
res_preds <- res_params$model$predictor$all
condo_unique_preds <- setdiff(condo_preds, res_preds)
ccao::vars_dict %>%
filter(
var_is_predictor,
!var_name_model %in% c("meta_sale_price")
) %>%
inner_join(
as_tibble(params$model$predictor$all),
as_tibble(condo_preds),
by = c("var_name_model" = "value")
) %>%
filter(
stringr::str_starts(var_name_model, "char_", negate = TRUE) |
var_name_model %in% c("char_yrblt", "char_land_sf") |
var_model_type == "condo",
stringr::str_starts(var_name_model, "ind_", negate = TRUE)
) %>%
distinct(
var_name_model,
`Feature Name` = var_name_pretty,
Category = var_type,
Type = var_data_type,
var_model_type
) %>%
mutate(
Category = recode(
Expand All @@ -106,13 +106,15 @@ ccao::vars_dict %>%
)
) %>%
mutate(`Unique to Condo Model` = ifelse(
var_model_type == "condo" |
`Feature Name` %in%
c("Condominium Building Year Built", "Condominium % Ownership"),
var_name_model != "loc_tax_municipality_name" & (
var_name_model %in% condo_unique_preds |
`Feature Name` %in%
c("Condominium Building Year Built", "Condominium % Ownership")
),
"X", ""
)) %>%
arrange(desc(`Unique to Condo Model`), Category) %>%
select(-var_model_type) %>%
select(-var_name_model) %>%
knitr::kable(format = "markdown")
```

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ the 2023 assessment model.
| Percent Population Mobility, Moved From Within Same County in Past Year | acs5 | numeric | |
| Longitude | loc | numeric | |
| Latitude | loc | numeric | |
| Municipality Name | loc | character | |
| FEMA Special Flood Hazard Area | loc | logical | |
| First Street Factor | loc | numeric | |
| First Street Risk Direction | loc | numeric | |
| School Elementary District GEOID | loc | character | |
| School Secondary District GEOID | loc | character | |
| Municipality Name | loc | character | |
| CMAP Walkability Score (No Transit) | loc | numeric | |
| CMAP Walkability Total Score | loc | numeric | |
| Airport Noise DNL | loc | numeric | |
Expand Down

0 comments on commit fc33def

Please sign in to comment.