From 05dc8e15147acb0fd5c763f3a62228fff7d50650 Mon Sep 17 00:00:00 2001 From: Christopher Crawford <32919420+chriscra@users.noreply.github.com> Date: Thu, 24 Mar 2022 08:14:32 -0400 Subject: [PATCH] Minor changes --- scripts/Crawford_abandonment_MS+SI.Rmd | 4 +++- scripts/_util/_util_files.R | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/Crawford_abandonment_MS+SI.Rmd b/scripts/Crawford_abandonment_MS+SI.Rmd index 97ee74d..8f24373 100644 --- a/scripts/Crawford_abandonment_MS+SI.Rmd +++ b/scripts/Crawford_abandonment_MS+SI.Rmd @@ -194,14 +194,16 @@ load(file = paste0(p_derived2, "/decay_endpoints_files", run_label, ".rds"), ver fitted_combo <- fitted_combo %>% left_join(site_labels) -# load new extrapolation data: +# load new potential abandonment data: potential_area_dat <- read_csv(file = paste0(p_derived2, "potential_area_dat", run_label, ".csv")) potential_persistence_dat <- read_csv(file = paste0(p_derived2, "potential_persistence_dat", run_label, ".csv")) + # load carbon data: site_carbon_df <- read_csv(file = paste0(p_derived2, "/carbon_df", run_label,".csv")) %>% left_join(site_labels) + ``` ```{r misc-notes, eval = FALSE} diff --git a/scripts/_util/_util_files.R b/scripts/_util/_util_files.R index e673eff..1ba0c2e 100644 --- a/scripts/_util/_util_files.R +++ b/scripts/_util/_util_files.R @@ -198,9 +198,12 @@ names(age_t_bins) <- site_df$site # --- max_age of abandonment --- # # ----------------------- # -max_age_t <- lapply(list.files(paste0(p_dat_derived, "max_age/", run_label), full.names = TRUE) %>% - grep(".tif", ., value = TRUE), - function(i) {terra::rast(i)}) +max_age_t <- lapply(1:11, function(i) { + terra::rast( + paste0(p_dat_derived, "max_age/", run_label, "/", + site_df$site[i], "_max_age", run_label, ".tif") + ) +}) names(max_age_t) <- site_df$site for (i in seq_along(max_age_t)) {names(max_age_t[[i]]) <- "max_age"} # remember: these are just 1987:2017