In the previous post, we learned how to acquire spatial data and manipulate it in a few basic but important ways in R. We did not run much code in the previous post. Indeed, to get up to speed, the only code you need to run is:
In this post, I introduce the reader to a seven-part R tutorial on various topics of importance to practitioners of data science. I start by discussing the overall purpose of the project, the structure of spatial data, and the basics of how to manage spatial data in R.
Here, I present some data on the question of a possible reverse coattail effect in the 2017 Virginia elections. I devise counterfactual predictions of Northam performance based on HoD district demographics, electoral history, and a combined model including both demographic and political fundamentals. I find reason to express some skepticism of reverse coattails: Northam slightly overperformed in districts that had a challenger in 2017 but not in 2013, but overperformed to a higher degree in districts with no Dem Delegate on the ballot. This is in general agreement with other work suggesting red suburbs turned against Gillespie, but did so without the aid of a stellar HoD candidate.
In this post I introduce a function that will take survey data associated with a codebook and render that data as a dataframe in R. This function fills a need for the surprisingly large volume of data originally devised in an earlier format like .dta, .spss, .sav, and .por that is not usable by many of the common read() functions in R due to not having any metadata directly associated with the fixed-width data itself.