readCookPVI {Ecdat} | R Documentation |
Read tables of the Cook Partisan Voting Index and returns a list with
components 'House' and 'Senate'. readCookPVI.
returns the
tables with the names of the current incumbents per
readUShouse
and readUSsenate
;
readCookPVI
tables do not include the names of the incumbents.
readCookPVI(url.= "http://en.wikipedia.org/wiki/Cook_Partisan_Voting_Index") readCookPVI.(url.= "http://en.wikipedia.org/wiki/Cook_Partisan_Voting_Index", UShouse=readUShouse(), USsenate=readUSsenate(), ...)
url. |
Universal resource locator to be read and processed to obtain the desired lists. |
UShouse, USsenate |
|
... |
optional arguments passed to |
The primary source for these data is the Cook Political Report web site. However, the current URL we have for these data on that web site includes "2012" in the title. If and when the numbers are updated, we would expect that file name to change.
To avoid that problem the code is currently set to read from the Wikipedia article on "Cook Partisan Voting Index".
The algorithm reads the web site into a list, finds the desired tables
on the list, then parses and formats them as desired. Then it merges
the results with UShouse
and USsenate
.
A list with components "House" and "Senate". Each contains a
data.frame
. The "House" data.frame returned by
readCookPVI
includes the following columns:
State |
name of the state |
District |
District, e.g, 1st, 2nd, At-Large |
PVInum |
PVI as a number ranging from roughly 50 to 150. 100 means that the vote split in that district was within 0.5 percent of the national average. 101 means that it tilts 1 percent (after rounding) to Republican. 98 means that it tilts 1 percent to Democratic; 99 is not used. |
PVIchar |
PVI rating in character format. For example, 'D+1' means that the vote tilted 1 percent toward Democratic more than the national average. 'R+1' means that it tilted 1 percent toward Republican. |
PartyOfRepresentative |
Party of the incumbent, either 'Republican' or 'Democratic' |
The 'Senate' data.frame includes the following columns:
State |
name of the state |
PVInum |
PVI numeric, as for 'House' |
PVIchar |
PVI rating in character format, as for 'House' |
PartyOfGovernor |
Party of the Governor of the state |
PartyInSenate |
party of the incumbent senators, either 'Republican', Democratic', or 'Both'. |
houseBalanceNum |
House balance as a number with 0 = 100 percent Democratic, 99.9 = 100 percent Republican, and 500 for the same number of Republicans as Democrats. |
houseBalanceChar |
Count by pary in the house delegation for that state, e.g., '6R, 1D' for 6 Republicans and 1 Democrat. |
readCookPVI.
adds to the above the information returned by
readUShouse
and readUSsenate
.
Spencer Graves
Wikipedia, "Cook Partisan Voting Index" The Cook Political Report
## Not run: CookPVI <- readCookPVI() ## End(Not run) CookPVI. <- readCookPVI.()