c.Distribution: Combine Distributions into a VectorDistribution

View source: R/c.Distribution.R

c.DistributionR Documentation

Combine Distributions into a VectorDistribution

Description

Helper function for quickly combining distributions into a VectorDistribution.

Usage

## S3 method for class 'Distribution'
c(..., name = NULL, short_name = NULL, decorators = NULL)

Arguments

...

distributions to be concatenated.

name, short_name, decorators

See VectorDistribution

Value

A VectorDistribution

See Also

VectorDistribution

Examples

# Construct and combine
c(Binomial$new(), Normal$new())

# More complicated distributions
b <- truncate(Binomial$new(), 2, 6)
n <- huberize(Normal$new(), -1, 1)
c(b, n)

# Concatenate VectorDistributions
v1 <- VectorDistribution$new(list(Binomial$new(), Normal$new()))
v2 <- VectorDistribution$new(
  distribution = "Gamma",
  params = data.table::data.table(shape = 1:2, rate = 1:2)
)
c(v1, v2)

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