# NOT RUN {
pdf <- runif(200)
mat <- matrix(pdf, 20, 10, FALSE, list(NULL, 1:10))
mat <- t(apply(mat, 1, function(x) x / sum(x)))
# coercion to matrix distribution
as.Distribution(mat, fun = "pdf")
# coercion to vector of weighted discrete distributions
as.Distribution(mat, fun = "pdf", vector = TRUE)
# }
Run the code above in your browser using DataLab