R/rmultinom1.R

Defines functions rmultinom1

rmultinom1 <- function(n, size, prob) {

  K <- length(prob) # #{classes}
  matrix(tabulate(sample(K, n * size, replace = TRUE, prob) + K * 0:(n - 1),
                  nbins = n * K),
         nrow = n, ncol = K, byrow = TRUE)
}

Try the UnifiedDoseFinding package in your browser

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

UnifiedDoseFinding documentation built on Oct. 16, 2022, 1:10 a.m.