powered by
This function generates data from a univariate or a bivariate discrete distribution
rcategorical(n, p)
a vector or a matrix
sample size
vector or matrix of values
p=1:3 names(p)=letters[1:3] x=rcategorical(1000, p) p=matrix(1:6, 2, 3) dimnames(p)=list(c("A","B"), letters[1:3]) x=rcategorical(1000, p)
Run the code above in your browser using DataLab