R/apply_if.R

Defines functions apply_if

Documented in apply_if

#' Conditionally apply a function
#'
#' @param predicate a predicate
#' @param func a function to apply
#' @param data data used by the function or otherwise returned
#' @param ... other objects involved in evaluation of the function
#' @return data
#' @export

apply_if <- function(predicate, func, data, ...){

  # browser()

  if(predicate){

  data <- func(data,...)
}
  data
}
ianmoran11/mmtable2 documentation built on Dec. 20, 2021, 5:58 p.m.