% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cluster-metrics.R
\name{as_mcml}
\alias{as_mcml}
\alias{as_mcml.cluster_summary}
\alias{as_mcml.group_tna}
\alias{as_mcml.mcml}
\alias{as_mcml.default}
\title{Convert to mcml}
\usage{
as_mcml(x, ...)

\method{as_mcml}{cluster_summary}(x, ...)

\method{as_mcml}{group_tna}(x, clusters = NULL, method = "sum", type = "tna", directed = TRUE, ...)

\method{as_mcml}{mcml}(x, ...)

\method{as_mcml}{default}(x, ...)
}
\arguments{
\item{x}{Object to convert.}

\item{...}{Additional arguments passed to methods.}

\item{clusters}{Integer or character vector of row-to-group assignments.
Required when the \code{group_tna} has the same labels across all groups
(row-level clustering from \code{tna::group_model(cluster_data(...))}).}

\item{method}{Aggregation method for macro weights (default \code{"sum"}).}

\item{type}{Transition type (default \code{"tna"}).}

\item{directed}{Logical; whether the network is directed (default \code{TRUE}).}
}
\value{
An \code{mcml} object with components \code{macro}, \code{clusters},
\code{cluster_members}, and \code{meta}.

An \code{mcml} object.

An \code{mcml} object. When \code{clusters} is provided,
\code{macro$data} contains the cluster assignments and \code{macro$weights}
is \code{NULL} (the macro is the sequence of clusters, not a summary).

The input \code{mcml} object unchanged.
}
\description{
Convert various objects to the \code{mcml} class -- a clean, tna-independent
representation of a multilayer cluster network.
}
\examples{
# From cluster_summary
mat <- matrix(c(0.5, 0.2, 0.3,
                0.1, 0.6, 0.3,
                0.4, 0.1, 0.5), 3, 3, byrow = TRUE,
              dimnames = list(c("A", "B", "C"), c("A", "B", "C")))
clusters <- list(G1 = c("A", "B"), G2 = c("C"))
cs <- cluster_summary(mat, clusters, type = "tna")
m <- as_mcml(cs)
m$macro$weights

\dontrun{
# From group_tna with cluster assignments (requires tna + Nestimate)
seqs <- data.frame(T1 = c("A", "B", "A"), T2 = c("B", "A", "B"))
mod <- tna::tna(seqs)
cl <- Nestimate::cluster_data(mod, k = 2)
gt <- tna::group_model(cl)
m <- as_mcml(gt, clusters = cl$assignments)
}
}
\seealso{
\code{\link{build_mcml}}, \code{\link{as_tna}}
}
