Skip to content

Commit

Permalink
fix: select with .data deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
k-doering-NOAA committed Apr 1, 2024
1 parent bfb64a8 commit ba9ef37
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions R/MS_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,19 @@ get_EM_catch_df <- function(EM_dir, dat) {
dplyr::summarise(catch = sum(.data[["catch"]])) %>%
merge(se, all.x = TRUE, all.y = FALSE) %>%
dplyr::ungroup() %>%
dplyr::select(.data[["year"]], .data[["seas"]], .data[["fleet"]], .data[["catch"]], .data[["catch_se"]])
dplyr::select(dplyr::all_of(c("year", "seas", "fleet", "catch","catch_se")))
catch_bio_df <- catch_bio_df %>%
dplyr::group_by(.data[["year"]], .data[["seas"]], .data[["fleet"]]) %>%
dplyr::summarise(catch = sum(.data[["catch"]])) %>%
merge(se, all.x = TRUE, all.y = FALSE) %>%
dplyr::ungroup() %>%
dplyr::select(.data[["year"]], .data[["seas"]], .data[["fleet"]], .data[["catch"]], .data[["catch_se"]])
dplyr::select(dplyr::all_of(c("year", "seas", "fleet", "catch", "catch_se")))
catch_F_df <- catch_F_df %>%
dplyr::group_by(.data[["year"]], .data[["seas"]], .data[["fleet"]]) %>%
dplyr::summarise(catch = sum(.data[["catch"]])) %>%
merge(se, all.x = TRUE, all.y = FALSE) %>%
dplyr::ungroup() %>%
dplyr::select(.data[["year"]], .data[["seas"]], .data[["fleet"]], .data[["catch"]], .data[["catch_se"]])
dplyr::select(dplyr::all_of(c("year","seas","fleet","catch","catch_se")))

catch_df <- as.data.frame(catch_df)
catch_bio_df <- as.data.frame(catch_bio_df)
Expand Down
8 changes: 3 additions & 5 deletions R/calc_F.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ get_retained_catch <- function(timeseries, units_of_catch) {
retain_catch_df <- retain_catch_df %>%
dplyr::group_by(.data[["Yr"]], .data[["Era"]], .data[["Seas"]], .data[["Units"]], .data[["Fleet"]]) %>%
dplyr::summarise(retained_catch = sum(.data[["retained_catch"]])) %>%
dplyr::select(.data[["Yr"]], .data[["Era"]], .data[["Seas"]], .data[["Units"]], .data[["Fleet"]], .data[["retained_catch"]])
dplyr::select(dplyr::all_of(c("Yr","Era","Seas","Units","Fleet","retained_catch")))
retain_catch_df <- as.data.frame(retain_catch_df) # want as df and not tibble
# units are not as concise as they could be, but leave for now.
retain_catch_df
Expand Down Expand Up @@ -242,10 +242,8 @@ get_dead_catch <- function(timeseries, units_of_catch) {
dead_catch_df <- dead_catch_df %>%
dplyr::group_by(.data[["Yr"]], .data[["Era"]], .data[["Seas"]], .data[["Units"]], .data[["Fleet"]]) %>%
dplyr::summarise(retained_catch = sum(.data[["retained_catch"]])) %>%
dplyr::select(
.data[["Yr"]], .data[["Era"]], .data[["Seas"]], .data[["Units"]], .data[["Fleet"]],
.data[["retained_catch"]]
)
dplyr::select(dplyr::all_of(c("Yr", "Era", "Seas", "Units", "Fleet",
"retained_catch")))
dead_catch_df <- as.data.frame(dead_catch_df)
# units are not as concise as they could be, but leave for now.
}
4 changes: 2 additions & 2 deletions R/initOM_create_devs_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ add_dev_changes <- function(fut_list, scen, iter, parlist, dat, vals_df, nyrs, c
custom_vals <- fut_list[["input"]][fut_list[["input"]][["scen"]] %in% c("all", scen) &
fut_list[["input"]][["par"]] == i &
fut_list[["input"]][["iter"]] == iter, ]
custom_vals <- dplyr::select(custom_vals, .data[["yr"]], .data[["value"]]) %>%
dplyr::rename(yrs = .data[["yr"]])
custom_vals <- dplyr::select(custom_vals, dplyr::all_of(c("yr","value"))) %>%
dplyr::rename(yrs = "yr")
vals_df <- dplyr::left_join(vals_df, custom_vals, by = "yrs") %>%
tidyr::replace_na(replace = list(value = tmp_base))
vals_df[[i]] <- vals_df[["value"]] # move to the correct column
Expand Down

0 comments on commit ba9ef37

Please sign in to comment.