From 027c47c0be725015d5298e7eb24b205184a157f3 Mon Sep 17 00:00:00 2001 From: Damonamajor Date: Mon, 5 Aug 2024 17:04:17 +0000 Subject: [PATCH] lintr --- Data_ingest_and_transformation.R | 12 ++++++------ Helper File.R | 3 --- analyses/leaflet_map.R | 10 ++++------ 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Data_ingest_and_transformation.R b/Data_ingest_and_transformation.R index 3bf67a3a..d6094e37 100644 --- a/Data_ingest_and_transformation.R +++ b/Data_ingest_and_transformation.R @@ -84,7 +84,7 @@ all_vars <- ls() for (var_name in all_vars) { # Check if the variable is a dataframe and ends with _run_id if (exists(var_name) && is.data.frame(get(var_name)) && - grepl(paste0("_", params$run_id, "$"), var_name)) { + grepl(paste0("_", params$run_id, "$"), var_name)) { new_name <- sub(paste0("_", params$run_id, "$"), "_new", var_name) assign(new_name, get(var_name), envir = .GlobalEnv) rm(list = var_name, envir = .GlobalEnv) @@ -92,7 +92,7 @@ for (var_name in all_vars) { # Check if the variable is a dataframe and ends with _comp_run_id if (exists(var_name) && is.data.frame(get(var_name)) && - grepl(paste0("_", params$comp_run_id, "$"), var_name)) { + grepl(paste0("_", params$comp_run_id, "$"), var_name)) { new_name <- sub(paste0("_", params$comp_run_id, "$"), "_comparison", var_name) assign(new_name, get(var_name), envir = .GlobalEnv) rm(list = var_name, envir = .GlobalEnv) @@ -103,7 +103,7 @@ for (var_name in all_vars) { for (var_name in all_vars) { # Check if the variable is a dataframe and ends with _run_id if (exists(var_name) && is.data.frame(get(var_name)) && - grepl(paste0("_", params$run_id, "$"), var_name)) { + grepl(paste0("_", params$run_id, "$"), var_name)) { new_name <- sub(paste0("_", params$run_id, "$"), "_new", var_name) assign(new_name, get(var_name), envir = .GlobalEnv) rm(list = var_name, envir = .GlobalEnv) @@ -111,7 +111,7 @@ for (var_name in all_vars) { # Check if the variable is a dataframe and ends with _comp_run_id if (exists(var_name) && is.data.frame(get(var_name)) && - grepl(paste0("_", params$comp_run_id, "$"), var_name)) { + grepl(paste0("_", params$comp_run_id, "$"), var_name)) { new_name <- sub(paste0("_", params$comp_run_id, "$"), "_comparison", var_name) assign(new_name, get(var_name), envir = .GlobalEnv) rm(list = var_name, envir = .GlobalEnv) @@ -174,13 +174,13 @@ pin_individual <- assessment_pin_new %>% diff_pred_pin_final_fmv = round((( pred_pin_final_fmv_new - pred_pin_final_fmv_comp) / - pred_pin_final_fmv_comp), 4), + pred_pin_final_fmv_comp), 4), pred_pin_final_fmv_new = dollar(pred_pin_final_fmv_new), pred_pin_final_fmv_comp = dollar(pred_pin_final_fmv_comp), diff_pred_pin_initial_fmv = round((( pred_pin_initial_fmv_new - pred_pin_initial_fmv_comp) / - pred_pin_initial_fmv_comp), 4), + pred_pin_initial_fmv_comp), 4), pred_pin_initial_fmv_new = dollar(pred_pin_initial_fmv_new), pred_pin_initial_fmv_comp = dollar(pred_pin_initial_fmv_comp) ) %>% diff --git a/Helper File.R b/Helper File.R index 22238669..07126bc7 100644 --- a/Helper File.R +++ b/Helper File.R @@ -81,6 +81,3 @@ print(subset_paths) # Calling the function directly with the subset paths model_fetch_run_subset("2024-07-09-cool-takuya", "2024", subset_paths, TRUE) - - - diff --git a/analyses/leaflet_map.R b/analyses/leaflet_map.R index ff82e7df..9274dfb5 100644 --- a/analyses/leaflet_map.R +++ b/analyses/leaflet_map.R @@ -1,5 +1,3 @@ - - 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 %>% @@ -26,7 +24,7 @@ create_leaflet_map <- function(dataset, legend_value, legend_title, order_scheme "
", "FMV Difference: ", dollar(diff_pred_pin_final_fmv), collapse = "
---
" ), - .groups = 'drop' + .groups = "drop" ) # Create the leaflet map @@ -37,7 +35,7 @@ create_leaflet_map <- function(dataset, legend_value, legend_title, order_scheme lat = ~ get(latitude), radius = 5, color = ~ pal(dataset_grouped[[legend_value]]), - popup = ~ popup_content + popup = ~popup_content ) %>% addPolygons( data = nbhd_borders, @@ -55,7 +53,7 @@ create_leaflet_map <- function(dataset, legend_value, legend_title, order_scheme highest_100 <- leaflet_data %>% - arrange(desc({{target_feature_value}})) %>% + arrange(desc({{ target_feature_value }})) %>% slice(1:100) -create_leaflet_map(highest_100, {{target_feature_value}}, "Largest 100 Values", order_scheme = "high") +create_leaflet_map(highest_100, {{ target_feature_value }}, "Largest 100 Values", order_scheme = "high")