Skip to contents

Flattens distributions placed in an ellipsis argument into a list, so that the ellipsis can include distributions themselves and lists of distributions.

Usage

dots_to_dsts(..., na.rm = FALSE)

Arguments

...

Distribution objects, or lists of distributions.

na.rm

Logical; remove NA entries? Note that NULL entries are always removed.

Value

A list of distributions contained in the ..., with NULL entries discarded. If no distributions are present, returns list().

Details

An error is thrown if, after discarding NULL entries, ... contains non-distributions. This function is essentially a wrapper around rlang::flatten().

Examples

d <- dst_norm(0, 1)
distplyr:::dots_to_dsts(d, list(d, d), NULL)
#> [[1]]
#> [1] "norm"       "parametric" "dst"       
#> 
#>  name :
#> [1] "norm"
#> 
#> [[2]]
#> [1] "norm"       "parametric" "dst"       
#> 
#>  name :
#> [1] "norm"
#> 
#> [[3]]
#> [1] "norm"       "parametric" "dst"       
#> 
#>  name :
#> [1] "norm"
#>