R/count.pairings.R

Defines functions count.pairings

Documented in count.pairings

count.pairings <- function(z, exact) {
	if (length(z) != length(exact)) {
		stop("z and exact must be the same length")
	}
	if (length(unique(z)) != 2 ) {
		stop("z must contain exactly 2 distinct values")
	}
	matchtab <- table(exact,z)
	sum(matchtab[,1]*matchtab[,2])
}

Try the rcbalance package in your browser

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

rcbalance documentation built on March 26, 2022, 1:07 a.m.