% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_prepare.R
\name{prepare_panel_data}
\alias{prepare_panel_data}
\title{Prepare panel data from the raw data in context}
\usage{
prepare_panel_data(context)
}
\arguments{
\item{context}{A `gwpr_context` with `raw_data`, `formula`, `id`, `time`,
and `model` populated.}
}
\value{
Updated context with `panel_data` and `metadata` populated.
}
\description{
Extracts the `id`, `time`, and formula variables from `raw_data`. Adds a
`raw_row_id` column preserving the original row positions. Sorts by id then
time. Records panel balance information in `metadata`. For `within` models,
records single-observation individuals in `metadata`.
}
\keyword{internal}
