#' 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
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.