R/rancatmat.R

rancatmat <-
function(n,m,cat=3)
{
mat<-matrix(0,n,m)
if(length(cat)<m)
cat<-rep(cat,length.out=m)
for (j in 1:m)
{
mat[,j]<-floor(runif(n)*cat[j])+1
}
mat
}

Try the ForImp package in your browser

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

ForImp documentation built on May 2, 2019, 8:17 a.m.