We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 12 columns, instead of 11 in line 9.
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
| precinct,rehmet_total,wom_total,total_2026,dem_total_2026,dem_pct_2026,trump_total,harris_total,total_2024,dem_pct_2024,diff_pct,relto | |
| 1001,200,89,289,200,69.20415224913495,646,683,1351,51.39202407825433,17.81212817088062,0.21391561806069578 | |
| 1005,74,3,77,74,96.1038961038961,75,346,426,82.18527315914488,13.91862294475122,0.1807511737089202 | |
| 1008,37,6,43,37,86.04651162790698,29,126,156,81.29032258064515,4.756189047261827,0.27564102564102566 | |
| 1010,21,2,23,21,91.30434782608695,67,125,195,65.10416666666666,26.200181159420296,0.11794871794871795 | |
| 1011,67,5,72,67,93.05555555555556,105,327,434,75.69444444444444,17.361111111111114,0.16589861751152074 | |
| 1015,143,18,161,143,88.81987577639751,264,403,674,60.41979010494752,28.400085671449986,0.23887240356083086 | |
| 1019,57,5,62,57,91.93548387096774,141,199,343,58.529411764705884,33.40607210626186,0.18075801749271136 | |
| 1056,5,1,6,5,83.33333333333334,40,113,156,73.8562091503268,9.477124183006538,0.038461538461538464 | |
| 1059,56,5,61,56,91.80327868852459,113,293,413,72.16748768472905,19.63 |
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
| Year | President | Party | House_Seat_Change | RDPI_YoY_Pct_Change_July | RDPI_Source | |
|---|---|---|---|---|---|---|
| 1946 | Harry S. Truman | D | -55 | -1.1 | FRED A067RL1A156NBEA (annual % chg, total RDPI): 1945-1946 | |
| 1950 | Harry S. Truman | D | -29 | 8.71 | FRED DPIC96: Q2-49 (1564.4) to Q2-50 (1700.7) | |
| 1954 | Dwight D. Eisenhower | R | -18 | -0.22 | FRED DPIC96: Q2-53 (1935.2) to Q2-54 (1931.0) | |
| 1958 | Dwight D. Eisenhower | R | -48 | -0.36 | FRED DPIC96: Q2-57 (2238.1) to Q2-58 (2230.0) | |
| 1962 | John F. Kennedy | D | -4 | 4.58 | FRED DSPIC96: Jul-61 (2517.6) to Jul-62 (2633.0) | |
| 1966 | Lyndon B. Johnson | D | -47 | 5.25 | FRED DSPIC96: Jul-65 (3097.8) to Jul-66 (3260.4) | |
| 1970 | Richard Nixon | R | -12 | 5.05 | FRED DSPIC96: Jul-69 (3705.6) to Jul-70 (3892.6) | |
| 1974 | Gerald R. Ford | R | -48 | -1.34 | FRED DSPIC96: Jul-73 (4499.0) to Jul-74 (4438.7) | |
| 1978 | Jimmy Carter | D | -15 | 4.77 | FRED DSPIC96: Jul-77 (4841.6) to Jul-78 (5072.8) |
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
| library(tidyverse) | |
| library(janitor) | |
| library(zoo) | |
| library(scales) | |
| clean_and_avg = function(series){ | |
| dat = read_csv(sprintf('%s.csv',series)) | |
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
| #' Description | |
| #' This file runs a live election-night forecast based on The Economist's pre-election forecasting model | |
| #' available at projects.economist.com/us-2020-forecast/president. | |
| #' It is resampling model based on https://pkremp.github.io/update_prob.html. | |
| #' This script does not input any real election results! You will have to enter your picks/constraints manually (scroll to the bottom of the script). | |
| #' | |
| #' Licence | |
| #' This software is published by *[The Economist](https://www.economist.com)* under the [MIT licence](https://opensource.org/licenses/MIT). The data generated by *The Economist* are available under the [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/). | |
| #' The licences include only the data and the software authored by *The Economist*, and do not cover any *Economist* content or third-party data or content made available using the software. More information about licensing, syndication and the copyright of *Economist* content can be fou |
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
| party | cycle | state_name | district | representative | WAR | ideo | |
|---|---|---|---|---|---|---|---|
| dem | 2024 | Alabama | 2 | Shomari Figures | -0.0142956 | -2.40172899842457 | |
| dem | 2024 | Alabama | 7 | Terri A. Sewell | -0.013435550000000001 | -2.07122942055397 | |
| dem | 2024 | Arizona | 3 | Yassamin Ansari | -0.0015478900000000001 | -1.9319779182875 | |
| dem | 2024 | Arizona | 4 | Greg Stanton | -0.008184455 | -2.18490810244875 | |
| dem | 2024 | Arizona | 7 | Raúl Grijalva | -0.018168 | -3.33143206893384 | |
| dem | 2024 | California | 2 | Jared Huffman | 0.00308888 | -3.35023512544864 | |
| dem | 2024 | California | 4 | Mike Thompson | 0.018705350000000003 | -2.10464881402841 | |
| dem | 2024 | California | 6 | Ami Bera | -0.013199550000000001 | -2.40293561432867 | |
| dem | 2024 | California | 7 | Doris Matsui | 0.0075622499999999995 | -2.67086471545931 |
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
| library(tidyverse) | |
| library(survey) | |
| # mutate weight variable | |
| dat = read_csv('anes_timeseries_2024_csv_20250430.csv') %>% | |
| filter(V241012 == 1) %>%# RVs | |
| mutate(weight = case_when(!is.na(V240103b) ~ V240103b, | |
| !is.na(V240104b) ~ V240104b, | |
| !is.na(V240104b) ~ V240104b, | |
| !is.na(V240103a) ~ V240103a, |
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
| library(tidyverse) | |
| library(zoo) | |
| dat = read_csv('~/Desktop/selected_outlays_2025-04-10.csv') %>% | |
| select(date, spend = `Cumulative year-to-date`) | |
| dat = tibble( | |
| date = ymd(as_date(min(dat$date):max(dat$date))) | |
| ) %>% |
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
| library(tidyverse) | |
| library(janitor) | |
| dat = read_csv('~/Downloads/Trump issue approval march - Sheet1.csv') | |
| dat = clean_names(dat) | |
| dat %>% group_by(category) %>% | |
| summarise_at(c('approve', 'disapprove', 'net'), mean) %>% | |
| mutate_if(is.numeric,round_half_up,1) %>% |
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
| download excel file from: https://elections.countyofdane.com/Precincts-Result/179/0005 |
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
| library(tidyverse) | |
| bayes_update_normal = function( | |
| data_mu, | |
| data_se, | |
| prior_mu = 0, | |
| prior_se = 3){ | |
| if(all(data_mu == 0)){ | |
| return(c(0,0)) |
NewerOlder