Extract a WeightedDiscrete or Matdist from a Matdist.

# S3 method for class 'Matdist'
md[i]

Arguments

md

Matdist from which to extract Distributions.

i

indices specifying distributions to extract.

Value

If length(i) == 1 then returns a WeightedDiscrete otherwise returns a Matdist.

Examples

m <- as.Distribution(
  t(apply(matrix(runif(200), 20, 10, FALSE,
                  list(NULL, sort(sample(1:20, 10)))), 1,
          function(x) x / sum(x))),
  fun = "pdf"
)
m[1]
#> WeightDisc(10) 
m[1:2]
#> Matdist(2x10)