R/pc_th.R

Defines functions pc_th

# compute thresholds
pc_th <- function(Y, freq=NULL, prop=NULL) {
  # my line:
  Y <- Y-min(Y, na.rm=T)+1# start at 1, required by tabulate
  if(is.null(prop)) {
    if(is.null(freq)) freq <- base::tabulate(Y)
    prop <- freq / sum(freq)
  }
  prop1 <- prop[-length(prop)]
  stats::qnorm(base::cumsum(prop1))
}
njaalf/discnorm documentation built on April 1, 2022, 7:41 p.m.