% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sequence-distances-clustering.R
\name{extract_representative_sequences}
\alias{extract_representative_sequences}
\title{Extract representative sequences from clusters}
\usage{
extract_representative_sequences(
  clustering,
  distance = NULL,
  n_per_cluster = 1L
)
}
\arguments{
\item{clustering}{A clustering result.}

\item{distance}{Optional distance when absent from \code{clustering}.}

\item{n_per_cluster}{Number of representatives per cluster.}
}
\value{
A data frame with cluster, rank, representative ID, and mean
within-cluster distance.
}
\description{
Extract representative sequences from clusters
}
\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)
fit <- cluster_sequences(distance, k = 2L)
extract_representative_sequences(fit)

}
