R/cramer_v.R

cramer_v <- function(x) {
    UseMethod("cramer_v")
}

cramer_v.table <- function(x) {
    N <- sum(x)
    k <- min(dim(x))
    if (k < 2)
        stop("k = 1")
    
    unname(sqrt(chisq.test(x)$statistic / (N*(k-1 ))))
}

Try the yapomif package in your browser

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

yapomif documentation built on May 2, 2019, 4:51 p.m.