utn100 / NCEAS-OSS2017-Project2

Coastal vulnerability: understanding interactions of the physical environment and social demographics
0 stars 1 forks source link

Census data #1

Closed CourtneyPageTan closed 6 years ago

ascyoung commented 7 years ago

Hey, I wrote a R script to pull down census data from the R acs package last night. I will show people today in group. I think it will help with our proprietary issues.

ascyoung commented 7 years ago

install.packages(acs) library(acs)

census_api_key("4ddd49b8e2809e4638d9833ecd06d026b40a8443")

api.key.install(key="4ddd49b8e2809e4638d9833ecd06d026b40a8443") coastal_counties <- read.csv("coastal_counties.csv")

county_lookup <- function(datain) {

mygeo <- geo.make(state=datain[2],datain[3],tract="*")

mydata <- acs.fetch(geo=mygeo, endyear=2011, table.number="B01003")

return(mydata)

}

popdata <- apply(coastal_counties,1, county_lookup)

citrus <-geo.make(state=12, county=17, tract="*") acs.fetch(geo=citrus, endyear=2010, table.number="B01003")

FL_escambia <- geo.make(state="FL", county="Escambia", tract="*")

acs.fetch(geo=FL_escambia, endyear=2011, table.number="B01003")

coastal.tracts=geo.make(state=fips.county[random.counties,1],

county=fips.county[random.counties,3], tract="*", check=T)

CourtneyPageTan commented 7 years ago

ACS code: https://www.socialexplorer.com/data/ACS2010/metadata/?ds=ACS10

CourtneyPageTan commented 7 years ago

ACS codes for our Bonding Social Capital indicators: https://docs.google.com/spreadsheets/d/184qrB0-CHCsT1UIc9h84U4Q7tUJ2ANA_byfqqMtihGk/edit?usp=sharing

CourtneyPageTan commented 7 years ago

First draft of social and demographic dataset:

Social and Demographic Data.txt

Social and Demographic FIPS Key.txt

CourtneyPageTan commented 7 years ago
CourtneyPageTan commented 7 years ago
CourtneyPageTan commented 7 years ago

GINI data is here: https://github.com/utn100/NCEAS-OSS2017-Project2.git