Learn R Programming

surveycore (version 0.8.3)

anes_2024: ANES 2024: American National Election Studies Time Series

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 (v240103av240103d), the recommended set for most analyses.

Usage

anes_2024

Arguments

Format

A data frame with 5,521 rows and 19 variables:

v240103a

Pre-election weight (FTF+Web combined). Use for variables asked before November 5, 2024.

v240103b

Post-election weight (FTF+Web combined). Use for variables asked after November 5, 2024.

v240103c

PSU (FTF+Web combined). Use as the cluster ID for variance estimation.

v240103d

Stratum (FTF+Web combined). Use as the stratification variable.

v240001

2024 Time Series Case ID. Unique respondent identifier.

v240003

Sample type: 1 = Panel, 2 = Fresh Web, 3 = Fresh FTF, 4 = GSS.

v240002c

Pre/Post interview completion: 1 = Pre-election only, 2 = Pre- and post-election.

v243002

State FIPS code.

v243007

Census region: 1 = Northeast, 2 = Midwest, 3 = South, 4 = West.

v241458x

Age on Election Day (summary). Top-coded at 80. -2 = missing.

v241550

Sex: 1 = male, 2 = female.

v241501x

Race/ethnicity (5-category summary): White non-Hispanic, Black non-Hispanic, Hispanic, Asian/NHPI non-Hispanic, Other/Multiracial non-Hispanic.

v241465x

Education (5-category summary): 1 = less than HS, 2 = HS diploma, 3 = some college, 4 = bachelor's degree, 5 = graduate degree.

v241566x

Household income (28 categories from < $5,000 to $250,000+).

v241177

Liberal-conservative self-placement (7-point scale): 1 = extremely liberal, 7 = extremely conservative. 99 = haven't thought about this.

v241222

Party identification strength: 1 = strong, 2 = not very strong.

v241223

Party identification lean (Independents): 1 = closer to Republican, 2 = neither, 3 = closer to Democrat.

v242066

Did respondent vote for President (POST): 1 = yes, 2 = no.

v242067

Presidential vote choice (POST): 1 = Harris, 2 = Trump, 3 = RFK Jr., 4 = West, 5 = Stein, 6 = Other.

Details

Survey design: Stratified cluster — use Taylor series linearization. Two weights are available depending on whether the analysis uses pre- or post-election variables:

# 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 )

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

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 as_survey().

  • Variable labels ("label" attribute): A human-readable description of each column. Example: attr(anes_2024$v241550, "label") returns "PRE: What is your sex?" (or similar ANES phrasing).

  • Value labels ("labels" attribute): A named numeric vector mapping each code to its meaning, including all missing-value codes. Example: attr(anes_2024$v241550, "labels") returns a vector with entries for Male, Female, and the applicable negative missing codes.

Examples

Run this code
# 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")

Run the code above in your browser using DataLab