Read the list of elected officials in the United States Senate
Read the list of elected officials in the United States Senate.
readUSsenate(url.= "https://www.senate.gov/general/contact_information/senators_cfm.xml", stateAbbreviations=Ecdat::USstateAbbreviations, fixNonStandard=subNonStandardNames, ...)
url. |
Universal resource locator to be read and processed to obtain the desired list. (The current default was suggested by Julia Silge.) |
stateAbbreviations |
a |
fixNonStandard |
function to look for and repair nonstandard names such as names containing characters with accent marks that are sometimes mangled by different software. |
... |
optional arguments passed to
|
1. Senate <- readHTMLTable(url)
2. Use camelParse
to remove duplication
in Name
.
3. Look for and fix surname
and givenName
with nonstandard characters using fixNonStandard
.
readUSsenate
returns a data.frame
with the
following columns:
State |
A factor identifying the state the person represents |
state |
A factor giving the 2-letter USPS code for the state represented |
Class |
an integer = 1, 2, or 3 for election in the 6-year cycle including 2008, 2010, or 2012, respectively. |
Name |
A character vector giving the name of each representative (in surname, given name format) |
party |
a factor identifying the party affiliation of each representative ("D", "R", "I" or ...) |
address |
character vector of physical addresses of offices in Washington, DC. |
phone |
character vector the phone number of the offices in Washington, DC. |
email |
a character vector giving the URL of their office contact form. |
website |
a character vector giving the URL of their web site in "senate.gov". |
surname |
character vector giving the surname of each representative |
givenName |
given name of each representative (possibly with middle name or initial, a nickname, and a suffix like "Jr.") |
leadership_position |
a character vector giving the names of the official leaders or blank. |
Spencer Graves with help from Julia Silge
getURL
readHTMLTable
camelParse
to remove duplication in Name
readUShouse
UShouse.senate
parseName
subNonStandardNames
if(!fda::CRAN()){ USsenate <- readUSsenate() }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.