R/getMaxNorm.R

Defines functions getMaxNorm getBounds

getBounds <-
function(x, dec=2) {
    if(!is.numeric(x))   { stop("x must be numeric") }
    if(!is.numeric(dec)) { stop("dec must be numeric") }
    if(dec %% 1)         { stop("dec must be an integer") }

    adj <- 10^dec
    return(c(floor(min(x)*adj), ceiling(max(x)*adj)) / adj)
}

getMaxNorm <-
function(x, dec=2) {
    if(!is.numeric(x)) { stop("x must be numeric") }

    mm <- range(x)                       # minimum and maximum
    return(getBounds(dnorm(seq(mm[1], mm[2], length.out=200),
                           mean(x), sd(x)), dec))
}

Try the shotGroups package in your browser

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

shotGroups documentation built on Sept. 18, 2022, 1:08 a.m.