Description Usage Arguments Details Value See Also Examples
Searches the Voteview database for roll calls and returns a data frame with bill IDs, the breakdown of voting, and other descriptive information. Takes any one or more of the arguments. See the GitHub Wiki here for more complete documentation.
1 2 3 |
q |
A string that is passed directly to the Voteview query parser. It can either specify parameters for the search, incorporate complex boolean logic, or be a simple string that will search all text fields. See Details. |
startdate |
A string of the format |
enddate |
A string of the format "yyyy-mm-dd" that is the latest possible date to search for a roll call. |
congress |
A numeric vector of the congresses to constrain the search to. The default NULL value returns results from all congresses. |
chamber |
A string in |
maxsupport |
Support is the share of Yea votes
over total Yea and Nay votes. |
minsupport |
A number specifying the minimum support allowed for returned votes. |
keyvote |
A string or boolean indicating the type of key vote to search for (e.g. 'CQ") or whether to search for any key vote (e.g. T). |
This function requires at least one argument. The user can use the q
field either to search across all text fields or to pass a more complicated advanced query. This is essentially like a "search box" where the user can just put in some key words, specific phrases in quotes, or can use notation like "support:[10 to 90]" along with boolean logic to build complicated queries.
Complete documentation for the query syntax can be found at the GitHub Wiki here. You can also see the vignette for other examples. In general, the following syntax is used, field:specific phrase (field:other phrase OR field:second phrase)
. For example, if you wanted to find votes with "war" and either "iraq" or "afghanistan" in any text field, you could set the query to be "alltext:war AND (alltext:iraq OR alltext:afghanistan)"
. Note that the AND
in the above is redundant as fields are joined by AND
by default. Numeric fields can be searched in a similar way, although users can also use square brackets and "to" for ranges of numbers. For example, the query for all votes about taxes in the 100th to 102nd congress could be expressed either using "alltext:taxes congress:100 OR congress:101 OR congress:102"
or using "alltext:taxes congress:[100 to 102]"
. Furthermore, users can specify exact phrases that they want to search like "description:'estate tax'"
.
The fields that can be searched with text are codes
, codes.Clausen
, codes.Peltzman
, codes.Issue
, description
, shortdescription
, bill
, and alltext
. The code and bill fields are searched exactly using regular expressions while in the other fields words are stemmed and searched anywhere in the field specified (unless the query is in quotes). The fields that can be searched numerically are congress
, yea
, nay
, and support
. Users can also search for stashed votes using the saved
field. Searching by individual legislator will be implemented soon.
A data.frame with the following columns, if the fields are available in the database:
id
Unique identifier for the roll call.
congress
The congress the roll call was held in.
chamber
The chamber the roll call was held in. Either "House"
or "Senate"
rollnumber
The roll call number of the vote.
date
The date the roll call was held, in string "yyyy-mm-dd"
format.
bill
Bill name abbreviation.
yea
The total number of 'Yea' votes.
nay
The total number of 'Nay' votes.
support
Percent of 'Yea' votes out of all 'Yea' or 'Nay'
votes (excludes absent).
vote_result
The official result of the vote, if available.
description
Official description of the bill.
short_description
A short description of the bill.
question
The question for the roll call (e.g. passage, cloture, amendment)
text
A short summary of the bill that may go beyond description
.
key_flags
The list of organizations that label this roll call a key vote. NULL if not a key vote.
Other columns that depend on the query. For example score
is the
value assigned to a roll call when searching using key words. Higher scores
mean better matches for the key words used in the search.
Also returned as the "qstring" attribute of the data.frame is the exact query string used in the search that can be copied in to the web interface or used in future queries.
'voteview_download'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Search for example roll calls
res <- voteview_search("Iraq")
res
## Return exact string used in search
attr(res, "qstring")
## Not run:
## Search for votes with a start date
res <- voteview_search("Iraq", startdate = "2005-01-01")
## Search for votes with an end date in just the house
res <- voteview_search("Iraq", enddate = "2005-01-01", chamber = "House")
## Search for votes with a start date in just the house in the 110th or 112th congress
res <- voteview_search("Iraq", startdate = "2005-01-01", congress = c(110, 112), chamber = "House")
## Search for "war on terror" AND iraq
res <- voteview_search("description:'war on terror' alltext:iraq")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.