R/odds.indo2prob.R

#' Convert Indonesian odds to Probabilities
#'
#' @param x A vector of Indonesian odds
#'
#' @return A vector of Probabilities
#'
#'@export
#'
#' @examples
#' odds.indo2hk(c(1.93,2.05))
odds.indo2prob <- function(x) {
  prob <- x
  prob[] <- NA_real_
  prob[which(x <= -1)] <- 1 + 1 / (x[which(x <= -1)] - 1)
  prob[which(x >= 1)] <- 1 / (1 + x[which(x >= 1)])
  prob
}

Try the odds.converter package in your browser

Any scripts or data that you put into this service are public.

odds.converter documentation built on May 1, 2019, 8:02 p.m.