A distribution object is one distribution, so length() gives 1 and
is.na() gives a single logical. as.list() wraps the distribution
in a list of one.
Value
For length(), the number 1. For is.na(), a single logical.
For as.list(), a list containing the one distribution.
Details
A distribution is built out of a list of its properties — a CDF, a
density, a mean — and without these methods base R reports on that list
rather than on the distribution. length() counted the properties and
is.na() tested each one, so dst_norm(0, 1) answered with eleven
FALSEs. Neither answer was about the distribution.
is.na() is TRUE for the Null distribution (dst_null()) and FALSE
for every other. The Null distribution is the missing value of the
distribution world, so it is the one that is.na() finds.
Note that the properties are still reachable, and are still what the
object is made of: x[["cdf"]] and names(x) are unchanged, and
eval_property() is the supported way to get at them. Only the questions
asked of the distribution as a whole now answer about the whole.
To hold several distributions, put them in a list; in a data frame, that is a list-column. A distribution does not have length beyond one.
