R/coalesce.R

Defines functions `%^%` coalesce

#' coalesce fills missing values
#' @param table a dataframe
#' @param value a value
#' @return dataframe whose missing values have been replaced by value
coalesce <- function(table, value) {
  table[is.na(table)] <- value
  table
}

`%^%` <- function(x, y) {
  coalesce(y, x)
}
HikaGenji/fql documentation built on April 12, 2021, 8:36 a.m.