R/coercions.R

Defines functions as_dist_structure.dist as_dist_structure.dist_structure

Documented in as_dist_structure.dist as_dist_structure.dist_structure

# ==========================================================================
# Coercions
# ==========================================================================
#
# as_dist_structure(x): promote a plain dist (e.g., from algebraic.dist)
# into a 1-component dist_structure (a trivial series of one component).
# Useful for polymorphic functions that accept dist_structure inputs but
# are also handed plain dists.
# ==========================================================================


#' @rdname as_dist_structure
#' @export
as_dist_structure.dist_structure <- function(x, ...) x


#' @rdname as_dist_structure
#' @export
as_dist_structure.dist <- function(x, ...) {
  series_dist(list(x))
}

Try the dist.structure package in your browser

Any scripts or data that you put into this service are public.

dist.structure documentation built on May 13, 2026, 1:07 a.m.