R/fct_weight_diff.R

Defines functions weight_diff

#' weight_diff
#'
#' @description A fct function
#'
#' @return The return value, if any, from executing the function.
#'
#' @noRd
weight_diff <- function(weight, bin) {
  dplyr::if_else(bin  == "Yes",
    weight ,
    pmax(0,
       weight - lag( weight ),
      na.rm = TRUE
    )
  )
}
Moohan/waste_challenge documentation built on March 22, 2022, 11:07 a.m.