ourMELONS/R/log_gamma.R
Waldir Leoncio fca9caa731 Restyled files
Ran through styler::style_dir() in the R and tests directories in preparation for #23.
2021-11-10 14:25:50 +01:00

8 lines
252 B
R

#' @title Log Gamma
#' @description Equal to log(gamma(x)) with special handling of x < 0 for
#' Matlab compatibility
#' @param x number
#' @return log(gamma(x)) for x > 0, Inf otherwise
log_gamma <- function(x) {
ifelse(x > 0, log(gamma(x)), Inf)
}