CensusAPI2000: US Census API function

Description Usage Arguments Details Value Author(s) References Examples

View source: R/CensusAPI2000.R

Description

Allows the user to access all Summary File 1 (SF1; 100-percent data; http://www.census.gov/prod/cen2000/doc/sf1.pdf) and SF3 (economic data). Requires the user to sign up for US Census API key, see http://api.census.gov/data/key_signup.html.

Usage

1
2
3
CensusAPI2000(variables, state.fips, 
level = c("county", "tract", "block group", "block", "cdp"),
 key, summaryfile = c("sf1", "sf3"))

Arguments

variables

This takes a character vector of SF1 IDs or ACS IDs, see http://www.census.gov/prod/cen2000/doc/sf1.pdf for SF1 and http://www.census.gov/programs-surveys/acs/ for ACS variables.

state.fips

State fips for desired demographic variables.

level

Takes "county", "tract", "block group", "block", or "cdp"

key

User provided key (see http://api.census.gov/data/key_signup.html)

summaryfile

"sf1" or "ACS"

Details

Add API Details.

Value

data.frame object.

Author(s)

Scott Chase (chase245@umn.edu), Zack W. Almquist (almquist@umn.edu)

References

http://api.census.gov/

Zack W. Almquist (2000). US Census Spatial and Demographic Data in R: The UScensus2000 Suite of Packages. Journal of Statistical Software, 37(6), 1-31. http://www.jstatsoft.org/v37/i06/.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
## Not run: 

key="YOUR KEY HERE"
sf1variables<-c("P001001","P003002",
"P003003","P003004","P003005")
sf3variables<-c("PCT024001",
"PCT024002","PCT024013")



#cdp level works
mainecdp<-CensusData2000(sf1variables,
state.fips=c("01","27"),level="cdp",key,summaryfile="sf1")
mncdp<-CensusData2000(sf1variables,
state.fips="27",level="cdp",key,summaryfile="sf1")

#county level works
mainecounty<-CensusData2000(sf1variables,
state.fips="23",level="county",key,summaryfile="sf1")
Twocounty<-CensusData2000(sf1variables,
state.fips=c("23","01"),level="county",key,summaryfile="sf1")

mncounty<-CensusData2000(sf1variables,state.fips="27",level="county",key,summaryfile="sf1")

#tract level works
az<-CensusData2000(sf1variables,
state.fips="04",level="tract",key,summaryfile="sf1")
mainetract<-CensusData2000(sf1variables,
state.fips="23",level="tract",key,summaryfile="sf1")

#block group level works
maineblkgrp<-CensusData2000(sf1variables,
state.fips="23",level="block group",key,summaryfile="sf1")
az<-CensusData2000(sf1variables,
state.fips="04",level="block group",key,summaryfile="sf1")

#block level works
maineblk<-CensusData2000(sf1variables,
state.fips="23",level="block",key,summaryfile="sf1")
ct<-CensusData2000(sf1variables,
state.fips="09",level="block",key,summaryfile="sf1")


## End(Not run)

UScensus2000 documentation built on May 2, 2019, 5:13 p.m.