get_state_code: Get state code from the state names.

Description Usage Arguments Value Note Examples

View source: R/prep_aqi.R

Description

Get state code from the state names.

Usage

1
get_state_code(aqs_api_email, aqs_api_key, state_names)

Arguments

aqs_api_email

AQS API email

aqs_api_key

AQS API key

state_names

A vector containing state names.

Value

A vector of state code per state name provided.

Note

The function uses the AQS API to fetch the data from the API endpoints. Use the following service to register as a user: A verification email will be sent to the email account specified. To register using the email address create and request this link (Replace myemail@example.com in the example with your email address.): (https://aqs.epa.gov/data/api/signup?email=myemail@example.com) You then need to set the email and the key in the .Renviron file as follows, i.e. aqs_api_email=myemail@example.com aqs_api_key=testkey1234

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
aqs_api_email = Sys.getenv('aqs_api_email')
aqs_api_key = Sys.getenv('aqs_api_key')

state_codes <- get_state_code(aqs_api_email = aqs_api_email,
                              aqs_api_key = aqs_api_key,
                              state_names = c('California', 'New York'))

## End(Not run)

wildviz documentation built on Aug. 23, 2021, 9:06 a.m.