[R] Reading data from Census API into R

Corey Sparks corey.sparks at UTSA.EDU
Thu Feb 6 20:16:11 CET 2014


I got it:
library(rjson)
library(plyr)

test<-fromJSON(file=url("http://api.census.gov/data/2010/sf1?key=mykey&get=P0030001,NAME&for=county:*&in=state:48"))
test2<-ldply(test)[-1,]
names(test2)<-ldply(test)[1,]
head(test2)

  P0030001             NAME state county
2    58458  Anderson County    48    001
3    14786   Andrews County    48    003
4    86771  Angelina County    48    005
5    23158   Aransas County    48    007
6     9054    Archer County    48    009
7     1901 Armstrong County    48    011





-----
Corey Sparks, PhD
Assistant Professor
Department of Demography
University of Texas at San Antonio
501 West César E. Chávez  Blvd 
Monterey Building 2.270C
San Antonio, TX 78207
210-458-3166
corey.sparks 'at' utsa.edu
coreysparks.weebly.com
--
View this message in context: http://r.789695.n4.nabble.com/Reading-data-from-Census-API-into-R-tp4684877p4684881.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list