R/update_target_bounds.R

Defines functions update_target_bounds

update_target_bounds <- function(targets_list, from = c("current", "new"), to = c("new", "current")) {
  # Which value are we updating
  from <- match.arg(from, c("current", "new"))
  # Which value are we using for the update
  to <- match.arg(to, c("current", "new"))

  # Handle names
  from <- c(paste0(from, "_lower_bounds"), paste0(from, "_upper_bounds"))
  to <- c(paste0(to, "_lower_bounds"), paste0(to, "_upper_bounds"))

  # Make change
  targets_list[[from[1]]] <- targets_list[[to[1]]]
  targets_list[[from[2]]] <- targets_list[[to[2]]]

  return(targets_list)
}

Try the imabc package in your browser

Any scripts or data that you put into this service are public.

imabc documentation built on April 12, 2021, 9:06 a.m.