Take a support apart: atoms() gives the points it places mass on, and
regions() gives the intervals it spreads mass across. Each accepts a
support object or a distribution.
Value
For atoms(), a discretes object. For regions(), a two-column
numeric matrix of intervals (lower, upper), one row each.
Details
These are the inverses of the constructors. discrete() builds a support
out of atoms and atoms() gives them back; continuous() builds one out of
regions and regions() gives those back. So the discrete part of a support
is discrete(atoms(x)), and its continuous part is continuous(regions(x)).
A support with no atoms gives an empty discretes object rather than
nothing, and one with no regions gives a matrix of no rows, so neither has
to be guarded against before being used. That is a definite answer: the
support says there is no part of that kind.
dst_null() is different. It has no support at all, so there is nothing to
take apart and nothing is known — both give NULL, as support() does
for it, rather than claiming it has no atoms. This mirrors range(), which
answers c(NA, NA) for it instead of refusing.
See also
Other Support:
empty_support(),
is_support(),
support(),
support-construction
Examples
atoms(mixed(discrete = 0, continuous = c(0, Inf)))
#> Numeric vector series of length 1:
#> 0
regions(continuous(c(0, 1), c(3, 4)))
#> lower upper
#> [1,] 0 1
#> [2,] 3 4
# Either part can be put back together into a support of its own.
s <- mixed(discrete = c(0, 5), continuous = c(0, 10))
discrete(atoms(s))
#> <support: discrete>
#> -- atoms --
#> Numeric vector series of length 2:
#> 0, 5
continuous(regions(s))
#> <support: continuous>
#> -- continuous --
#> [0, 10]
