[.Arrdist | R Documentation |
Extract a WeightedDiscrete or Matdist or Arrdist from a Arrdist.
## S3 method for class 'Arrdist'
ad[i = NULL, j = NULL]
ad |
Arrdist from which to extract Distributions. |
i |
indices specifying distributions (first dimension) to extract, all returned if NULL. |
j |
indices specifying curves (third dimension) to extract, all returned if NULL. |
If length(i) == 1
and length(j) == 1
then returns a WeightedDiscrete otherwise if
j
is NULL
returns an Arrdist. If length(i)
is greater than 1 or NULL
returns a
Matdist if length(j) == 1
.
pdf <- runif(400)
arr <- array(pdf, c(20, 10, 2), list(NULL, sort(sample(1:20, 10)), NULL))
arr <- aperm(apply(arr, c(1, 3), function(x) x / sum(x)), c(2, 1, 3))
darr <- as.Distribution(arr, fun = "pdf")
# WeightDisc
darr[1, 1]
# Matdist
darr[1:2, 1]
# Arrdist
darr[1:3, 1:2]
darr[1, 1:2]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.