R/dots_precedence.R

Defines functions dots_precedence

dots_precedence <- function(name, value, env) {
  if (length(env$dots) == 0) {
    return(setNames(list(value), name))
  }
  the_match <- pmatch(names(env$dots), name)
  the_match <- !is.na(the_match)
  if (sum(the_match) == 0) {
    res <- value
  } else {
    the_match <- names(env$dots)[the_match]
    # Set the value to what's in the dots
    res       <- env$dots[[the_match]]
    # Remove this from the dot list
    env$dots[[the_match]] <- NULL
  }
  setNames(list(res), name)
}

Try the epiflows package in your browser

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

epiflows documentation built on April 10, 2023, 5:06 p.m.