Skip to content

Commit

Permalink
lintr
Browse files Browse the repository at this point in the history
  • Loading branch information
Damonamajor committed Aug 5, 2024
1 parent 56c7323 commit 027c47c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
12 changes: 6 additions & 6 deletions Data_ingest_and_transformation.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ 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)
}

# 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)
Expand All @@ -103,15 +103,15 @@ 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)
}

# 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)
Expand Down Expand Up @@ -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)
) %>%
Expand Down
3 changes: 0 additions & 3 deletions Helper File.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)



10 changes: 4 additions & 6 deletions analyses/leaflet_map.R
Original file line number Diff line number Diff line change
@@ -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 %>%
Expand All @@ -26,7 +24,7 @@ create_leaflet_map <- function(dataset, legend_value, legend_title, order_scheme
"<br>", "FMV Difference: ", dollar(diff_pred_pin_final_fmv),
collapse = "<br>---<br>"
),
.groups = 'drop'
.groups = "drop"
)

# Create the leaflet map
Expand All @@ -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,
Expand All @@ -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")

0 comments on commit 027c47c

Please sign in to comment.