rcategorical {moodlequizR}R Documentation

rcategorical

Description

This function generates data from a univariate or a bivariate discrete distribution

Usage

rcategorical(n, p)

Arguments

n

sample size

p

vector or matrix of values

Value

a vector or a matrix

Examples

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)

[Package moodlequizR version 2.1.1 Index]