votesmart

library(votesmart)

The first step to using the votesmart package is to register an API key and store it in an environment variable by following these instructions.

Let’s make sure our API key is set.

# If our key is not registered in this environment variable,
# the result of `Sys.getenv("VOTESMART_API_KEY")` will be `""` (i.e. a string of `nchar` 0)
key <- Sys.getenv("VOTESMART_API_KEY")

key_exists <- (nchar(key) > 0)

if (!key_exists) knitr::knit_exit()