% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data.R
\docType{data}
\name{anes_2024}
\alias{anes_2024}
\title{ANES 2024: American National Election Studies Time Series}
\format{
A data frame with 5,521 rows and 19 variables:
\describe{
\item{v240103a}{Pre-election weight (FTF+Web combined). Use for
variables asked before November 5, 2024.}
\item{v240103b}{Post-election weight (FTF+Web combined). Use for
variables asked after November 5, 2024.}
\item{v240103c}{PSU (FTF+Web combined). Use as the cluster ID for
variance estimation.}
\item{v240103d}{Stratum (FTF+Web combined). Use as the stratification
variable.}
\item{v240001}{2024 Time Series Case ID. Unique respondent identifier.}
\item{v240003}{Sample type: \code{1} = Panel, \code{2} = Fresh Web, \code{3} = Fresh
FTF, \code{4} = GSS.}
\item{v240002c}{Pre/Post interview completion: \code{1} = Pre-election only,
\code{2} = Pre- and post-election.}
\item{v243002}{State FIPS code.}
\item{v243007}{Census region: \code{1} = Northeast, \code{2} = Midwest,
\code{3} = South, \code{4} = West.}
\item{v241458x}{Age on Election Day (summary). Top-coded at 80.
\code{-2} = missing.}
\item{v241550}{Sex: \code{1} = male, \code{2} = female.}
\item{v241501x}{Race/ethnicity (5-category summary): White non-Hispanic,
Black non-Hispanic, Hispanic, Asian/NHPI non-Hispanic,
Other/Multiracial non-Hispanic.}
\item{v241465x}{Education (5-category summary): \code{1} = less than HS,
\code{2} = HS diploma, \code{3} = some college, \code{4} = bachelor's degree,
\code{5} = graduate degree.}
\item{v241566x}{Household income (28 categories from < $5,000 to
$250,000+).}
\item{v241177}{Liberal-conservative self-placement (7-point scale):
\code{1} = extremely liberal, \code{7} = extremely conservative.
\code{99} = haven't thought about this.}
\item{v241222}{Party identification strength: \code{1} = strong,
\code{2} = not very strong.}
\item{v241223}{Party identification lean (Independents): \code{1} = closer to
Republican, \code{2} = neither, \code{3} = closer to Democrat.}
\item{v242066}{Did respondent vote for President (POST): \code{1} = yes,
\code{2} = no.}
\item{v242067}{Presidential vote choice (POST): \code{1} = Harris,
\code{2} = Trump, \code{3} = RFK Jr., \code{4} = West, \code{5} = Stein, \code{6} = Other.}
}
}
\source{
American National Election Studies. 2024 Time Series Study.
Available at electionstudies.org (free account required to download raw
data; the processed \code{.rda} is included in the package).
Prepared by \verb{data-raw/prepare-anes-2024.R}.
}
\usage{
anes_2024
}
\description{
A 19-variable extract from the 2024 American National Election Studies
(ANES) Time Series Study, a landmark biennial pre- and post-election survey
of the American electorate. Fielded via face-to-face interview and web
(n = 5,521). This extract uses the FTF + Web combined design variables
(\code{v240103a}–\code{v240103d}), the recommended set for most analyses.
}
\details{
\strong{Survey design:} Stratified cluster — use Taylor series linearization.
Two weights are available depending on whether the analysis uses pre- or
post-election variables:

\if{html}{\out{<div class="sourceCode r">}}\preformatted{# Pre-election analysis (party ID, ideology, candidate preference)
svy_pre <- as_survey(anes_2024,
  ids     = v240103c,
  strata  = v240103d,
  weights = v240103a,
  nest    = TRUE
)

# Post-election analysis (validated vote choice)
svy_post <- as_survey(anes_2024,
  ids     = v240103c,
  strata  = v240103d,
  weights = v240103b,
  nest    = TRUE
)
}\if{html}{\out{</div>}}

\strong{Missing value codes:} The ANES uses negative integer codes for missing
data throughout: \code{-9} = Refused, \code{-8} = Don't know, \code{-4} = Technical error,
\code{-1} = Inapplicable, and others. These must be recoded to \code{NA} before
analysis. Check \code{attr(anes_2024$v241177, "labels")} for the full set of
codes for a given variable.

\strong{Metadata:}
All columns carry variable labels and value labels as R attributes from the
original Stata file, automatically extracted into surveycore's metadata
system when you call \code{as_survey()}.
\itemize{
\item \strong{Variable labels} (\code{"label"} attribute): A human-readable description of
each column. Example: \code{attr(anes_2024$v241550, "label")} returns
\code{"PRE: What is your sex?"} (or similar ANES phrasing).
\item \strong{Value labels} (\code{"labels"} attribute): A named numeric vector mapping
each code to its meaning, including all missing-value codes. Example:
\code{attr(anes_2024$v241550, "labels")} returns a vector with entries for
\code{Male}, \code{Female}, and the applicable negative missing codes.
}
}
\examples{
# Variables in the dataset
names(anes_2024)

# Create pre-election design
svy <- as_survey(
  anes_2024,
  ids = v240103c,
  strata = v240103d,
  weights = v240103a,
  nest = TRUE
)

# Inspect variable label (ANES uses opaque V-codes; labels give context)
attr(anes_2024$v241177, "label")

# Inspect value labels, including missing-value codes
attr(anes_2024$v241177, "labels")
}
\keyword{datasets}
