R/fill_nchoosek.R

Defines functions fill_nchoosek

fill_nchoosek <- function(c0, npj) {
  npj_choose_x1j <- lapply(
    npj,
    function(n) vapply(0:n, function(k) choose(n, k), 0)
  )
  max_length <- max(vapply(npj_choose_x1j, length, 0))
  npj_choose_x1j <- t(vapply(npj_choose_x1j, function(x) c(x, rep(0, max_length - length(x))), rep(0, max_length)))
  return(npj_choose_x1j)
}

Try the contingencytables package in your browser

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

contingencytables documentation built on Sept. 11, 2024, 6:20 p.m.