% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sequence_terminal.R
\name{actor_endpoints}
\alias{actor_endpoints}
\title{Tidy per-actor endpoint summary of a wide-format sequence dataset}
\usage{
actor_endpoints(data, cols = NULL)
}
\arguments{
\item{data}{A wide-format matrix or data.frame where rows are
actors and columns are time steps. Cells are state labels;
\code{NA} represents missing observations. If \code{data} is a
\code{data.frame}, non-character/-factor columns (e.g. an \code{id}
column) are dropped via the \code{cols} argument.}

\item{cols}{Optional character vector of state-column names. If
\code{NULL} (default) every column is treated as a state column.}
}
\value{
A tidy \code{data.frame} with one row per actor and columns:
\describe{
\item{\code{actor}}{Row number (or row name if present).}
\item{\code{first_state}}{First non-NA state.}
\item{\code{last_state}}{Last non-NA state.}
\item{\code{first_step}}{Column index of the first observed state.}
\item{\code{last_step}}{Column index of the last observed state.}
\item{\code{n_observed}}{Number of non-NA cells.}
\item{\code{dropped_out}}{\code{TRUE} iff every cell after \code{last_step}
is \code{NA} and \code{last_step < ncol(data)}.}
}
}
\description{
For each actor (row), reports the first and last observed states,
the time indices at which they appear, the number of observed
steps, and a \code{dropped_out} flag that is \code{TRUE} when the actor
has a \emph{terminal-NA} pattern (after the final observed step,
every remaining cell is \code{NA}).
}
\examples{
actor_endpoints(trajectories) |> head()

}
\seealso{
\code{\link[=mark_terminal_state]{mark_terminal_state()}}, \code{\link[=chain_structure]{chain_structure()}}
}
