tracking_api_token: Install a Tracking API token to your .Renviro without the...

tracking_api_tokenR Documentation

Install a Tracking API token to your .Renviro without the need to reference the token directly in each call.

Description

This function adds a Tracking API token to your .Renviron file so it can be called securely without being stored in your code. After you have run this function, the token can be called by running Sys.getenv("TRACKING_API_TOKEN").

Usage

tracking_api_token(token, overwrite = TRUE, install = TRUE)

Arguments

token

Specifies the API token that was provided to you by the Tracking Program as a quoted string (e.g., "C6016D98-CGCA-495D-BF0B-EAAE20BADD98"). A token can be acquired by emailing, trackingsupport(AT)cdc.gov. Further information available at https://ephtracking.cdc.gov/apihelp.

overwrite

Allows you to overwrite an existing TRACKING_API_TOKEN stored in your .Renviron file. Defaults to TRUE.

install

Allows you to store the token in your .Renviron file for use in future sessions. Defaults to TRUE.

References

This function and accompanying documentation were adapted from the tidycensus package with very little modification. Walker K, Herman M (2023). tidycensus: Load US Census Boundary and Attribute Data as 'tidyverse' and 'sf'-Ready Data Frames. R package version 1.3.2, https://walker-data.com/tidycensus/.

Examples

## Not run: 

tracking_api_token("XXXXXXXXXXXXXXXXX")

#After you run this function, reload your environment so you can use the token without restarting R.
readRenviron("~/.Renviron")

## End(Not run)


CDCgov/EPHTrackR documentation built on June 6, 2024, 9:21 a.m.