rcategorical | R Documentation |
This function generates data from a univariate or a bivariate discrete distribution
rcategorical(n, p)
n |
sample size |
p |
vector or matrix of values |
a vector or a matrix
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.