rsunlight-package: Sunlight Foundation data from R

Description Details Author(s)


You need API keys for Sunlight Foundation APIs. Please get your own API keys if you plant to use these functions for Sunlight Labs ( We set up the functions so that you can use either env vars, or R options. For env vars, put an entry in your .Renviron file with the name SUNLIGHT_LABS_KEY, so the full thing would be SUNLIGHT_LABS_KEY=<key>. For R options, put the key in your .Rprofile file like options(SunlightLabsKey = "key"). Both are called on R startup, and then you don't have to enter your API key for each run of a function.


Currently we have functions to interface with the following Sunlight Foundation APIs, where functions for each API are prefixed with a two letter code indicating the service.

  • Congress API ('cg')

  • Open States API ('os')

  • Capitol Words API ('cw')

Note that Puerto Rico is not included in Sunlight Foundation data.


Scott Chamberlain

Thomas J. Leeper

Search within the rsunlight package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.