From 3282cae2d99573cf0457bbea35b1216c9e4fe9ed Mon Sep 17 00:00:00 2001 From: "Juan F. Fung" Date: Fri, 2 Aug 2024 11:17:54 -0400 Subject: [PATCH] Create design iteration column at preprocessing to streamline plotting #23 --- R/frbca.R | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/R/frbca.R b/R/frbca.R index 5ca26cb..edc2fda 100644 --- a/R/frbca.R +++ b/R/frbca.R @@ -46,10 +46,17 @@ preprocess_model <- function(eal, cost, p) { ## separate models by height ## join_cols = c('system', 'model', 'num_stories', 'intervention', 'design_s', 'design_ns') + names_structural = c("RC III", "RC IV", "backup-frame") models <- list() dat <- eal |> - dplyr::left_join(cost, by=join_cols) |> - dplyr::mutate(total_area=p$floor_area*num_stories) + dplyr::left_join(cost, by=join_cols) |> + dplyr::mutate(total_area=p$floor_area*num_stories) |> + dplyr::mutate(design=paste(design_s, design_ns, sep="-")) |> + dplyr::mutate(design=case_when( + design %in% "baseline-baseline" ~ "baseline", + design %in% "baseline-nsfr" ~ "nonstructural", + design %in% paste(names_structural, "baseline", sep="-") ~ "structural", + design %in% paste(names_structural, "nsfr", sep="-") ~ "full")) systems <- dat |> dplyr::distinct(system) |> pull() for (j in systems) { dat_j = dat |> dplyr::filter(system == j)