sub-.Matdist: Extract one or more Distributions from a Matdist

[.MatdistR Documentation

Extract one or more Distributions from a Matdist

Description

Extract a WeightedDiscrete or Matdist from a Matdist.

Usage

## 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]
m[1:2]

distr6 documentation built on March 28, 2022, 1:05 a.m.