% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/markov.R
\name{transition_matrix}
\alias{transition_matrix}
\title{Extract A Transition Matrix}
\usage{
transition_matrix(x, type = c("probability", "count"), lag_class = NULL)
}
\arguments{
\item{x}{A \code{grd_markov} or \code{grd_spatial_markov} object.}

\item{type}{\code{"probability"} or \code{"count"}.}

\item{lag_class}{Optional lag class for \code{grd_spatial_markov}.}
}
\value{
A matrix.
}
\description{
Extract A Transition Matrix
}
\examples{
\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
panel <- data.frame(
  id = rep(letters[1:4], each = 3),
  year = rep(2020:2022, times = 4),
  value = c(8, 9, 11, 10, 12, 13, 15, 14, 16, 20, 22, 25)
)
markov <- panel |>
  classify_dynamics(id, year, value, k = 3) |>
  markov_dynamics(id, year, class)

transition_matrix(markov, "count")
\dontshow{\}) # examplesIf}
}
