Main Page/Research/Papers/kernel density estimators

From phurvitz
Jump to: navigation, search


Contents

ZCTAs

one of the things I wanted to calculate was the pop of zctas:

  • download: ZCTA
  • replace successive blanks with commas (sed "s/ */,/")
  • R code to get the mean population
z <- read.csv("zcta5.txt",header=F, as.is=T)
states <- z[substr(z[,1],1,2)!="-8",]
states <- states[substr(states[,1],1,2)!="-9",]
states <- states[substr(states[,1],1,2)!="-9",]
states <- states[substr(states[,1],1,2)!="-7",]
states <- states[substr(states[,1],1,2)!="PR",]
states <- states[substr(states[,1],1,2)!="PA",]
states <- states[states[,4]!="(part)",]
states[,4] <- as.numeric(states[,4])
mean.zcta.pop <- mean(states[,4])