Obtain and set your Census API key
tidycensus is an R package designed to return data from the US Census Bureau ready for use within the Tidyverse.
To acquire data from the US Census Bureau using the tidycensus R package, you must first acquire and set a Census API key. After obtaining your key, you can install it for future use with the census_api_key() function in tidycensus.
This exercise uses a fake API key for purposes of illustration.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Analyzing US Census Data in R
अभ्यास निर्देश
- Load the
tidycensuspackage into your DataCamp R session. - Set the Census API key with
census_api_key(). - Check your API key with
Sys.getenv().
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Load the tidycensus package into your R session
library(___)
# Define your Census API key and set it with census_api_key()
api_key <- "rw6pozt48ur2ugc8kg69x5phdrtnuhb2cb1subd6"
census_api_key(___)
# Check your API key
___("CENSUS_API_KEY")