diff --git a/analyses/leaflet_map.R b/analyses/leaflet_map.R deleted file mode 100644 index 9274dfb5..00000000 --- a/analyses/leaflet_map.R +++ /dev/null @@ -1,59 +0,0 @@ -create_leaflet_map <- function(dataset, legend_value, legend_title, order_scheme = "high", longitude = "loc_longitude", latitude = "loc_latitude") { - # Filter neighborhoods that have at least one observation - nbhd_borders <- nbhd %>% - right_join(dataset, by = c("town_nbhd" = "meta_nbhd_code")) - - # Create the color palette based on order_scheme - if (order_scheme == "low") { - pal <- colorNumeric(palette = "Reds", domain = dataset[[legend_value]], reverse = TRUE) - } else { - pal <- colorNumeric(palette = "Reds", domain = dataset[[legend_value]]) - } - - # Group by pin and create popup content - dataset_grouped <- dataset %>% - group_by(meta_pin, !!sym(longitude), !!sym(latitude)) %>% - summarize( - popup_content = paste( - "
", "Pin: ", meta_pin, - "
", "SHAP:", dollar(!!sym(params$added_feature_shap)), - "
", "Relative SHAP", shap_relative, - "
", "Feature:", sprintf("%.2f", !!sym(params$added_feature)), - "
", "New FMV:", pred_pin_final_fmv_new, - "
", "Comparison FMV: ", pred_pin_final_fmv_comparison, - "
", "FMV Difference: ", dollar(diff_pred_pin_final_fmv), - collapse = "
---
" - ), - .groups = "drop" - ) - - # Create the leaflet map - leaflet(dataset_grouped) %>% - addProviderTiles(providers$CartoDB.Positron) %>% - addCircleMarkers( - lng = ~ get(longitude), - lat = ~ get(latitude), - radius = 5, - color = ~ pal(dataset_grouped[[legend_value]]), - popup = ~popup_content - ) %>% - addPolygons( - data = nbhd_borders, - color = "black", - weight = 2, - fill = FALSE - ) %>% - addLegend( - "bottomright", - pal = pal, - values = dataset_grouped[[legend_value]], - title = legend_title - ) -} - - -highest_100 <- leaflet_data %>% - arrange(desc({{ target_feature_value }})) %>% - slice(1:100) - -create_leaflet_map(highest_100, {{ target_feature_value }}, "Largest 100 Values", order_scheme = "high") diff --git a/analyses/new-feature-template-categorical.R b/analyses/new-feature-template-categorical.R deleted file mode 100644 index 3dd0a0b1..00000000 --- a/analyses/new-feature-template-categorical.R +++ /dev/null @@ -1,7 +0,0 @@ -summarize( - plurality_type = ifelse(sum(get(params$added_feature)) == 0, NA, - as.character(names(which.max(table(get(params$added_feature))))) - ), - plurality_percentage = ifelse(sum(get(params$added_feature)) == 0, NA, - max(get(params$added_feature)) / sum(get(params$added_feature)) * 100 - ),