R/int_rmult.R

Defines functions rmult

#### Multinomial data generationa ####

# Internal function genExposure - returns categorical data
#
# @param p a vector of probabilities
# @return An integer (group) ranging from 1 to length of the probability vector

.rmult <- function (p) {
  nums = length(p)
  t(stats::rmultinom(n=1,size=1, p = p)) %*% c(1:nums)
}
kgoldfeld/simstudy documentation built on Dec. 9, 2018, 12:11 p.m.