% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rank-mobility.R
\name{rank_mobility}
\alias{rank_mobility}
\title{Compute Rank Mobility}
\usage{
rank_mobility(
  data,
  id,
  time,
  value,
  compare = c("endpoint", "adjacent"),
  descending = TRUE
)
}
\arguments{
\item{data}{A long data frame or \code{sf} object.}

\item{id, time, value}{Columns identifying spatial unit, time, and value.}

\item{compare}{\code{"endpoint"} compares first and last observed periods per
unit. \code{"adjacent"} compares adjacent periods.}

\item{descending}{If \code{TRUE}, larger values receive better ranks.}
}
\value{
A \code{grd_rank_mobility} data frame or \code{sf} object.
}
\description{
Computes simple rank changes for map-ready exploratory analysis.
}
\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)
)

rank_mobility(panel, id, year, value)
\dontshow{\}) # examplesIf}
}
