% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sequence-distances-clustering.R
\name{cluster_sequences}
\alias{cluster_sequences}
\title{Cluster sequences from a distance object}
\usage{
cluster_sequences(
  distance,
  k,
  method = c("hierarchical", "pam", "clara"),
  linkage = "average",
  seed = 1L,
  ...
)
}
\arguments{
\item{distance}{A \code{dist} object or square matrix.}

\item{k}{Number of clusters.}

\item{method}{\code{"hierarchical"}, \code{"pam"}, or \code{"clara"}.}

\item{linkage}{Hierarchical linkage method.}

\item{seed}{Reproducibility seed for optional stochastic methods.}

\item{...}{Additional arguments passed to the selected clustering function.}
}
\value{
A list of class \code{gp3_sequence_clustering} containing assignments,
model object, medoid identifiers where available, and settings.
}
\description{
Cluster sequences from a distance object
}
\examples{
sequences <- data.frame(
  sequence_id = rep(c("s1", "s2", "s3", "s4"), each = 4L),
  sequence_order = rep(1:4, times = 4L),
  state = c("A", "B", "C", "D", "A", "B", "C", "C",
            "D", "C", "B", "A", "D", "C", "A", "A"),
  group = rep(c("g1", "g2"), each = 8L),
  stringsAsFactors = FALSE
)
distance <- compute_sequence_distance(sequences)
cluster_sequences(distance, k = 2L)

}
