RESENT INITIAL EMAIL, TOO BIG ATTACHMENTS REPLACED WITH LINKS I created a dataset, linked. Had to manually copy and paste from the NY Times website.
> head (data, 3) STATE EQCOUNTY RMARGIN_2016 RMARGIN_2020 NVOTERS_2020 SUB_STATEVAL_2016 1 Alabama Mobile 13.3 12 181783 0 2 Alabama Dallas -37.5 -38 17861 0 3 Alabama Tuscaloosa 19.3 15 89760 0 > tail (data, 3) STATE EQCOUNTY RMARGIN_2016 RMARGIN_2020 NVOTERS_2020 SUB_STATEVAL_2016 4248 Wyoming Uinta 58.5 63 9400 0 4249 Wyoming Sublette 63.0 62 4970 0 4250 Wyoming Johnson 64.3 61 4914 0 > head (data [data [,1] == "Alaska",], 3) STATE EQCOUNTY RMARGIN_2016 RMARGIN_2020 NVOTERS_2020 SUB_STATEVAL_2016 68 Alaska ED 40 14.7 -24.0 82 1 69 Alaska ED 37 14.7 -1.7 173 1 70 Alaska ED 38 14.7 -0.4 249 1 EQCounty, is the County or Equivalent. Several states, D.C., Alaska, Connecticut, Maine, Massachusetts, Rhode Island and Vermont are different. RMargin(s) are the republican percentages minus the democrate percentages, as 2 or 3 digit numbers between 0 and 100. The last column is 0s or 1s, with 1s for Alaska, Connecticut, Maine, Massachusetts, Rhode Island and Vermont, where I didn't have the 2016 margins, so the 2016 margins have been replaced with state-levels values. Then I scaled the margins, based on the number of voters. i.e. wx2016 <- 1000 * x2016 * nv / max.nv (Where x2016 is equal to RMARGIN_2020, and nv is equal to NVOTERS_2020). There may be a much better way. And came up the following plots (linked) and output (follows): ---INPUT--- PATH = "<PATH TO FILE>" data = read.csv (PATH, header=TRUE) #raw data x2016 <- as.numeric (data$RMARGIN_2016) x2020 <- as.numeric (data$RMARGIN_2020) nv <- as.numeric (data$NVOTERS_2020) subs <- as.logical (data$SUB_STATEVAL) #computed data max.nv <- max (nv) wx2016 <- 1000 * x2016 * nv / max.nv wx2020 <- 1000 * x2020 * nv / max.nv diffs <- wx2020 - wx2016 OFFSET <- 500 p0 <- par (mfrow = c (2, 2) ) #plot 1 plot (wx2016, wx2020, main="All Votes\n(By County, or Equivalent)", xlab="Scaled Republican Margin, 2016", ylab="Scaled Republican Margin, 2020") abline (h=0, v=0, lty=2) #plot 2 OFFSET <- 200 plot (wx2016, wx2020, xlim = c (-OFFSET, OFFSET), ylim = c (-OFFSET, OFFSET), main="All Votes\n(Zoomed In)", xlab="Scaled Republican Margin, 2016", ylab="Scaled Republican Margin, 2020") abline (h=0, v=0, lty=2) OFFSET <- 1000 #plot 3 J1 <- order (diffs, decreasing=TRUE)[1:400] plot (wx2016 [J1], wx2020 [J1], xlim = c (-OFFSET, OFFSET), ylim = c (-OFFSET, OFFSET), main="400 Biggest Shifts Towards Republican", xlab="Scaled Republican Margin, 2016", ylab="Scaled Republican Margin, 2020") abline (h=0, v=0, lty=2) abline (a=0, b=1, lty=2) #plot 4 J2 <- order (diffs)[1:400] plot (wx2016 [J2], wx2020 [J2], xlim = c (-OFFSET, OFFSET), ylim = c (-OFFSET, OFFSET), main="400 Biggest Shifts Towards Democrat", xlab="Scaled Republican Margin, 2016", ylab="Scaled Republican Margin, 2020") abline (h=0, v=0, lty=2) abline (a=0, b=1, lty=2) par (p0) #most democrat I = order (wx2020)[1:30] cbind (data [I,], scaled.dem.vote = -1 * wx2020 [I]) #biggest move toward democrat head (cbind (data [J2,], diffs = diffs [J2]), 30) ---OUTPUT--- #most democrat > cbind (data [I,], scaled.dem.vote = -1 * wx2020 [I]) STATE EQCOUNTY RMARGIN_2016 RMARGIN_2020 NVOTERS_2020 SUB_STATEVAL_2016 scaled.dem.vote 229 California Los Angeles -49.3 -44 3674850 0 44000.000 769 Illinois Cook -53.1 -47 1897721 0 24271.164 4073 Washington King -48.8 -53 1188152 0 17135.953 3092 Pennsylvania Philadelphia -67.0 -63 701647 0 12028.725 215 California Alameda -63.5 -64 625710 0 10897.163 227 California Santa Clara -52.1 -49 726186 0 9682.875 238 California San Diego -19.7 -23 1546144 0 9676.942 2683 New York Brooklyn -62.0 -49 693937 0 9252.871 2162 Minnesota Hennepin -34.9 -43 753716 0 8819.350 2074 Michigan Wayne -37.1 -37 863382 0 8692.908 2673 New York Manhattan -76.9 -70 446861 0 8511.986 221 California San Francisco -75.2 -73 413642 0 8216.898 3495 Texas Dallas -26.1 -32 920772 0 8017.934 1741 Maryland Prince George's -79.7 -80 365857 0 7964.559 510 Florida Broward -34.9 -30 959418 0 7832.303 3057 Oregon Multnomah -56.3 -61 458395 0 7609.044 3563 Texas Travis -38.6 -45 605034 0 7408.882 565 Georgia DeKalb -62.9 -67 369341 0 6733.839 3942 Virginia Fairfax -35.8 -42 578931 0 6616.624 492 D.C. D.C. -86.4 -87 279152 0 6608.766 562 Georgia Fulton -40.9 -46 522050 0 6534.770 230 California Contra Costa -43.0 -48 498340 0 6509.196 2674 New York Queens -53.6 -39 597928 0 6345.617 257 Colorado Denver -54.8 -64 350606 0 6106.041 2677 New York Bronx -79.1 -66 329638 0 5920.271 3530 Texas Harris -12.3 -13 1633671 0 5779.208 1718 Maryland Montgomery -55.4 -57 369405 0 5729.781 2888 Ohio Cuyahoga -35.2 -34 605268 0 5599.987 2745 North Carolina Mecklenburg -29.4 -35 565980 0 5390.506 2894 Ohio Franklin -25.8 -31 606022 0 5112.231 #biggest move toward democrat > head (cbind (data [J2,], diffs = diffs [J2]), 30) STATE EQCOUNTY RMARGIN_2016 RMARGIN_2020 NVOTERS_2020 SUB_STATEVAL_2016 diffs 1751 Massachusetts Boston -26.8 -67.00 273133 1 -2987.8625 113 Arizona Maricopa 2.8 -2.00 2046295 0 -2672.8209 3531 Texas Tarrant 8.6 -0.16 830104 0 -1978.7776 2162 Minnesota Hennepin -34.9 -43.00 753716 0 -1661.3194 3564 Texas Collin 16.7 5.00 486917 0 -1550.2480 3495 Texas Dallas -26.1 -32.00 920772 0 -1478.3065 238 California San Diego -19.7 -23.00 1546144 0 -1388.4309 563 Georgia Gwinnett -5.8 -18.00 413166 0 -1371.6547 3565 Texas Denton 20.0 8.00 416610 0 -1360.4147 4073 Washington King -48.8 -53.00 1188152 0 -1357.9434 564 Georgia Cobb -2.2 -14.00 393340 0 -1263.0208 2075 Michigan Oakland -8.1 -14.00 778418 0 -1249.7561 291 Colorado Jefferson -6.9 -19.00 376430 0 -1239.4528 292 Colorado El Paso 22.3 11.00 375058 0 -1153.2866 2321 Missouri St. Louis County -16.2 -24.00 528107 0 -1120.9259 3563 Texas Travis -38.6 -45.00 605034 0 -1053.7077 277 Colorado Arapahoe -14.1 -25.00 346740 0 -1028.4681 2744 North Carolina Wake -20.2 -26.00 624049 0 -984.9339 3942 Virginia Fairfax -35.8 -42.00 578931 0 -976.7398 1116 Kansas Johnson 2.6 -8.00 338343 0 -975.9407 3562 Texas Bexar -13.4 -18.00 757667 0 -948.4110 2077 Michigan Kent 3.1 -6.00 359915 0 -891.2545 257 Colorado Denver -54.8 -64.00 350606 0 -877.7434 110 Arizona Pima -13.6 -20.00 501058 0 -872.6264 2625 New Jersey Monmouth 9.3 -1.60 292654 0 -868.0432 2745 North Carolina Mecklenburg -29.4 -35.00 565980 0 -862.4809 3567 Texas Williamson 9.7 -1.30 287696 0 -861.1660 2894 Ohio Franklin -25.8 -31.00 606022 0 -857.5355 203 California Riverside -5.4 -11.00 558759 0 -851.4770 3966 Virginia Virginia Beach 3.5 -8.00 253477 0 -793.2257 DISCLAIMER:\ I can not guarantee the accuracy of this da...{{dropped:15}} ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.