I started an R package a while back, and a few people have shown interest, so I thought it was time to revist the code. govdat is an interface to various APIs for government data: currently the Sunlight Labs APIs, and the New York Times congress API. Returned objects from functions are simple lists. In future versions of govdat, I may change how data is returned. The following are examples (which is also the package vignette) of using the Sunlight Labs API. I will add examples of using the New York Times Congress API once their site is up again; I’m doing this on 2013-08-28, just after the takedown of their site.
I show just a bit of each data object returned for brevity. And yes, I realize this is not related at all to ecology.
You will need an API key to use both Sunlight Labs APIs and the New York Times APIs. Get your API key at Sunlight Labs here and NYT here. You can pass in your key within each function or you can put the key in your .Rprofile file on your machine (which is read from the default R working directory) and the key will be read in automatically inside the function. I recommend the latter option.
Do let me know of bugs or feature requests over at the Github issues page here.
Gets details (subcommittees + membership) for a committee by id.
Gets a list of all committees that a member serves on, including subcommittes.
Get districts for a latitude/longitude.
Get districts that overlap for a certain zip code.
Search congress people and senate members.
Search congress people and senate members for a zip code.
Find the popularity of a phrase over a period of time.
Get a list of how many times the phrase “united states” appears in the Congressional Record in each month between January and June, 2010:
Plot more data
Search OpenStates bills.
Search Legislators on OpenStates.
Search for entities - that is, politicians, individuals, or organizations with the given name
Return the top contributoring organizations, ranked by total dollars given. An organization’s giving is broken down into money given directly (by the organization’s PAC) versus money given by individuals employed by or associated with the organization.