Skip to content

Commit ad47243

Browse files
committed
unknown update :/
1 parent b5842b7 commit ad47243

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

R/fct_combine_mcs_cstock.R

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ fct_combine_sims_C_allstock <- function(.ad, .cs, .usr){
123123

124124
c_check <- fct_check_pool(.c_sub = c_sub, .c_unit = .usr$c_unit, .c_fraction = .usr$c_fraction)
125125
c_form <- fct_make_formula(.c_check = c_check, .c_unit = .usr$c_unit)
126+
c_pools <- stringr::str_remove_all(c_form, pattern = "\\+|\\*|\\(|\\)") |>
127+
stringr::str_split(pattern = " ") |>
128+
unlist() |>
129+
unique()
126130

127131
tibble(
128132
period = period,
@@ -159,24 +163,30 @@ fct_combine_sims_C_allstock <- function(.ad, .cs, .usr){
159163

160164
if ("DG_ratio" %in% unique(sims_C_all$c_form)) {
161165

162-
## + Get pools used for DG
166+
## + Get elements used for DG
163167
if (.usr$dg_pool == "ALL") {
164168
dg_pool <- "C_all"
165169
} else {
166170
dg_pool <- stringr::str_split(.usr$dg_pool, pattern = ",") |> purrr::map(stringr::str_trim) |> unlist()
167171
}
168-
dg_pool_intact <- paste0(dg_pool, "_intact")
172+
#dg_pool_intact <- paste0(dg_pool, "_intact")
169173

170-
## + Filter DG to modify formula and recalculate
174+
## + Filter DG_ratio elements
171175
sims_DG <- sims_C_all |>
172176
dplyr::filter(.data$c_form == "DG_ratio") |>
173177
dplyr::mutate(
174178
lu_intact = stringr::str_remove(.data$lu_id, pattern = .usr$dg_ext)
175179
)
176180

181+
## + Filter intact elements associated with DG land uses
177182
sims_C_intact <- sims_C_all |>
178-
dplyr::filter(.data$lu_id %in% unique(sims_DG$lu_intact)) |>
179-
dplyr::select("sim_no", lu_intact = "lu_id", !!!rlang::syms(dg_pool))
183+
dplyr::filter(.data$lu_id %in% unique(sims_DG$lu_intact))
184+
185+
intact_pools <- stringr::str_subset( |>
186+
dplyr::select("c_form") |>
187+
purrr::discard(~all(is.na(.)))
188+
#dplyr::select("sim_no", lu_intact = "lu_id", !!!rlang::syms(dg_pool))
189+
180190

181191
names(sims_C_intact)[!(names(sims_C_intact) %in% c("sim_no", "lu_intact"))] <- dg_pool_intact
182192

R/fct_make_formula.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fct_make_formula <- function(.c_check, .c_unit){
5656
c_eq_out <- c_eq1
5757

5858
if (.c_check$has_RS) {
59-
c_eq_out["BGB"] <- "AGB*RS"
59+
c_eq_out["BGB"] <- "AGB * RS"
6060
} else if (!.c_check$has_BG){
6161
c_eq_out <- c_eq_out[!(names(c_eq_out) %in% c("plus_bgb", "BGB"))]
6262
}
-95 Bytes
Binary file not shown.

mocaredd.Rproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Version: 1.0
2+
ProjectId: 59e49fa2-c663-4d17-89e0-9f1f39ed9ade
23

34
RestoreWorkspace: No
45
SaveWorkspace: No

tests/test-others.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
library(Microsoft365R)
2+
odb <- get_business_onedrive()

0 commit comments

Comments
 (0)