Created
March 3, 2026 15:16
-
-
Save carlislerainey/47b1b9b8a8ba13949ce1ccc1c2cd3a9a to your computer and use it in GitHub Desktop.
Asking Pilot Data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Compute SDs of key variables from the asking_pilot dataset (crdata package). | |
| # | |
| # asking_pilot is a pilot study on affective polarization: respondents are | |
| # assigned to control / "ask" / "tell" conditions, with pre- and post- | |
| # treatment measurements of feeling thermometers, APS, and political | |
| # sectarianism. | |
| # ── 1. Install pak (if not already present) ────────────────────────────────── | |
| if (!requireNamespace("pak", quietly = TRUE)) { | |
| install.packages("pak") | |
| } | |
| # ── 2. Install crdata via pak ───────────────────────────────────────────────── | |
| # crdata is not on CRAN; pak handles GitHub / non-CRAN sources cleanly. | |
| pak::pak("carlislerainey/crdata") | |
| # ── 3. Load the dataset ─────────────────────────────────────────────────────── | |
| # crdata datasets are accessed with :: rather than data(); this is the | |
| # package's intended (unusual) usage pattern. | |
| d <- crdata::asking_pilot | |
| # ── 4. Compute SDs ─────────────────────────────────────────────────────────── | |
| # Pre-treatment composite political sectarianism score | |
| sd(d$pre_political_sectarianism, na.rm = TRUE) | |
| # Post-treatment nine-item Affective Polarization Scale (APS) composite | |
| sd(d$aps, na.rm = TRUE) | |
| # Post-treatment out-party feeling thermometer | |
| sd(d$out_party_ft, na.rm = TRUE) | |
| # Post-treatment difference in feeling thermometers (in-party minus out-party) | |
| sd(d$diff_ft, na.rm = TRUE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment