#============================================================
#
# install choroplethr
#===========================================================
#install_github("choroplethr", "trulia")
#install.packages(c("choroplethrAdmin1","choroplethrMaps","choroplethrZip"))
library(devtools)
library(choroplethr)
library(choroplethrMaps)
library(choroplethrAdmin1)
#==================================================================
# Set up parallel processing
# leave two cores for operating system
#==================================================================
cluster <- makeCluster(detectCores() - 2)
registerDoParallel(cluster)
Install the api key
#api.key.install('your api key here');
To obtain data on Japanese,Chinese or African populations in the US
# choroplethr package contains most map functions, ggmap,maps,mapproj,Rgooglemaps etc
#install.packages(list, dependencies = TRUE)
# install.packages("choroplethrMaps" )
#acs.lookup(endyear, span = 5, dataset = "acs", keyword,
#table.name, table.number, case.sensitive = T)
Japanese=acs.lookup(keyword = "Japanese", endyear = 2013)
Chinese=acs.lookup(keyword = "Chinese", endyear = 2013)
African=acs.lookup(keyword = "African", endyear = 2013)
#head(African)
#head(Chinese)
#head(Japanese)
head(African)
## An object of class "acs.lookup"
## endyear= 2013 ; span= 5
##
## results:
## variable.code table.number table.name variable.name
## 1 B02001_003 B02001 Race Black or African American alone
#l = acs.fetch("B02006", "county", column_idx=9)
kansas09[1:5,1:3]
## ACS DATA:
## 2005 -- 2009 ;
## Estimates w/90% confidence intervals;
## for different intervals, see confint()
## Universe...TOTAL.POPULATION..Total
## Allen County, Kansas 13403 +/- 0
## Anderson County, Kansas 7900 +/- 0
## Atchison County, Kansas 16469 +/- 0
## Barber County, Kansas 4714 +/- 0
## Barton County, Kansas 27654 +/- 0
## Universe...TOTAL.POPULATION..Male
## Allen County, Kansas 6580 +/- 115
## Anderson County, Kansas 3911 +/- 48
## Atchison County, Kansas 7925 +/- 114
## Barber County, Kansas 2332 +/- 43
## Barton County, Kansas 13313 +/- 113
## Universe...TOTAL.POPULATION..Male..Under.5.years
## Allen County, Kansas 399 +/- 21
## Anderson County, Kansas 273 +/- 11
## Atchison County, Kansas 502 +/- 29
## Barber County, Kansas 124 +/- 6
## Barton County, Kansas 885 +/- 2
install api key from census bureau
data(kansas09)
str(kansas09)
## Formal class 'acs' [package ".GlobalEnv"] with 9 slots
## ..@ endyear : int 2009
## ..@ span : int 5
## ..@ geography :'data.frame': 105 obs. of 4 variables:
## .. ..$ Geography : chr [1:105] "Allen County, Kansas" "Anderson County, Kansas" "Atchison County, Kansas" "Barber County, Kansas" ...
## .. ..$ Geographic.Summary.Level: int [1:105] 50 50 50 50 50 50 50 50 50 50 ...
## .. ..$ Geography.Identifier.1 : int [1:105] 20001 20003 20005 20007 20009 20011 20013 20015 20017 20019 ...
## .. ..$ Geography.Identifier : chr [1:105] "05000US20001" "05000US20003" "05000US20005" "05000US20007" ...
## ..@ acs.colnames : chr [1:55] "Universe...TOTAL.POPULATION..Total" "Universe...TOTAL.POPULATION..Male" "Universe...TOTAL.POPULATION..Male..Under.5.years" "Universe...TOTAL.POPULATION..Male..5.to.9.years" ...
## ..@ modified : logi TRUE
## ..@ acs.units : Factor w/ 5 levels "count","dollars",..: 1 1 1 1 1 1 1 1 1 1 ...
## ..@ currency.year : int 2009
## ..@ estimate : num [1:105, 1:55] 13403 7900 16469 4714 27654 ...
## .. ..- attr(*, "dimnames")=List of 2
## .. .. ..$ : chr [1:105] "Allen County, Kansas" "Anderson County, Kansas" "Atchison County, Kansas" "Barber County, Kansas" ...
## .. .. ..$ : chr [1:55] "Universe...TOTAL.POPULATION..Total" "Universe...TOTAL.POPULATION..Male" "Universe...TOTAL.POPULATION..Male..Under.5.years" "Universe...TOTAL.POPULATION..Male..5.to.9.years" ...
## ..@ standard.error: num [1:105, 1:55] 0 0 0 0 0 0 0 0 0 0 ...
## .. ..- attr(*, "dimnames")=List of 2
## .. .. ..$ : chr [1:105] "Allen County, Kansas" "Anderson County, Kansas" "Atchison County, Kansas" "Barber County, Kansas" ...
## .. .. ..$ : chr [1:55] "Universe...TOTAL.POPULATION..Total" "Universe...TOTAL.POPULATION..Male" "Universe...TOTAL.POPULATION..Male..Under.5.years" "Universe...TOTAL.POPULATION..Male..5.to.9.years" ...
# subset
#kansas09[1:4,6:9]
#(head(kansas09))
# subset
#kansas09[1:4,6:9]
#kansas09[1:4,]
# more complicated subsets
#kansas09[c("Linn County, Kansas", "Wilson County, Kansas") ,
#grep(pattern="21.years", x=acs.colnames(kansas09))]
# addition on estimates and errors
kansas09[1:4,25]+kansas09[1:4,49]
## ACS DATA:
## 2005 -- 2009 ;
## Estimates w/90% confidence intervals;
## for different intervals, see confint()
## ( Universe...TOTAL.POPULATION..Male..85.years.and.over + Universe...TOTAL.POPULATION..Female..85.years.and.over )
## Allen County, Kansas 310 +/- 80.4300938703916
## Anderson County, Kansas 246 +/- 99.9249718538864
## Atchison County, Kansas 425 +/- 112.16059914248
## Barber County, Kansas 168 +/- 81.1233628494283
# can even multiply and divide
# males per female, by county
kansas09[1:4,2]/kansas09[1:4,26]
## ACS DATA:
## 2005 -- 2009 ;
## Estimates w/90% confidence intervals;
## for different intervals, see confint()
## ( Universe...TOTAL.POPULATION..Male : Universe...TOTAL.POPULATION..Female )
## Allen County, Kansas 0.964385167814744 +/- 0.0234156104043347
## Anderson County, Kansas 0.980446227124593 +/- 0.016851805022657
## Atchison County, Kansas 0.927551498127341 +/- 0.0181987328141948
## Barber County, Kansas 0.979009235936188 +/- 0.0252629434427822
# (males<5 plus females<5) * 12
(kansas09[7,3]+kansas09[7,27]) * 12
## ACS DATA:
## 2005 -- 2009 ;
## Estimates w/90% confidence intervals;
## for different intervals, see confint()
## ( ( Universe...TOTAL.POPULATION..Male..Under.5.years + Universe...TOTAL.POPULATION..Female..Under.5.years ) * 12 )
## Brown County, Kansas 8088 +/- 461.024945095165
# some replacement: males<5 as a percentage of all males
kansas09[,3]=kansas09[,3]/kansas09[,2]
# acs.fetch(endyear, span = 5, geography, table.name,
# table.number, variable, keyword, dataset = "acs",
# key, col.names = "auto", ...)
#lots.o.data=acs.fetch(geo=geo.make(state="WA",county=c(33,35,53,61), tract="*"), table.number="B01001",endyear=2014)
# geo.make(us, region, division, state, county, county.subdivision,
# place, tract, block.group, msa, csa, necta, urban.area,
# congressional.district, state.legislative.district.upper,
# state.legislative.district.lower, puma, zip.code,
# american.indian.area, school.district.elementary,
# school.district.secondary, school.district.unified,
# combine = F, combine.term = "aggregate", check = FALSE, key = "auto")
#
# a density plot for a single variable
plot(kansas07[7,10])
# a density plot for a single variable
(kansas07[7,10])
## ACS DATA:
## 2007 ;
## Estimates w/90% confidence intervals;
## for different intervals, see confint()
## Universe...TOTAL.POPULATION..Male..22.to.24.years
## Wyandotte County, Kansas 3486 +/- 691
# load ACS data
data(kansas07)
# plot a single value
plot(kansas07[4,4])
# plot by geography
plot(kansas07[,10])
# plot by columns
plot(kansas07[4,3:10])
# a density plot for a single variable
plot(kansas07[7,10])
# same, using some graphical parameters
plot(kansas07[7,10], col="blue", err.col="purple", err.lty=3)
plot(kansas07[7,49], col="lightblue", type="h", x.res=3000,
err.col="purple", err.lty=3, err.lwd=4, conf.level=.99,
main=(paste("Distribution of Females>85 Years in ",
geography(kansas07)[7,1], sep="")),
sub="(99-percent margin of error shown in purple)")
acs.lookup(endyear=2014, span=5, table.number="B01001")
## An object of class "acs.lookup"
## endyear= 2014 ; span= 5
##
## results:
## variable.code table.number table.name variable.name
## 1 B01001_001 B01001 Sex by Age Total:
## 2 B01001_002 B01001 Sex by Age Male:
## 3 B01001_003 B01001 Sex by Age Male: Under 5 years
## 4 B01001_004 B01001 Sex by Age Male: 5 to 9 years
## 5 B01001_005 B01001 Sex by Age Male: 10 to 14 years
## 6 B01001_006 B01001 Sex by Age Male: 15 to 17 years
## 7 B01001_007 B01001 Sex by Age Male: 18 and 19 years
## 8 B01001_008 B01001 Sex by Age Male: 20 years
## 9 B01001_009 B01001 Sex by Age Male: 21 years
## 10 B01001_010 B01001 Sex by Age Male: 22 to 24 years
## 11 B01001_011 B01001 Sex by Age Male: 25 to 29 years
## 12 B01001_012 B01001 Sex by Age Male: 30 to 34 years
## 13 B01001_013 B01001 Sex by Age Male: 35 to 39 years
## 14 B01001_014 B01001 Sex by Age Male: 40 to 44 years
## 15 B01001_015 B01001 Sex by Age Male: 45 to 49 years
## 16 B01001_016 B01001 Sex by Age Male: 50 to 54 years
## 17 B01001_017 B01001 Sex by Age Male: 55 to 59 years
## 18 B01001_018 B01001 Sex by Age Male: 60 and 61 years
## 19 B01001_019 B01001 Sex by Age Male: 62 to 64 years
## 20 B01001_020 B01001 Sex by Age Male: 65 and 66 years
## 21 B01001_021 B01001 Sex by Age Male: 67 to 69 years
## 22 B01001_022 B01001 Sex by Age Male: 70 to 74 years
## 23 B01001_023 B01001 Sex by Age Male: 75 to 79 years
## 24 B01001_024 B01001 Sex by Age Male: 80 to 84 years
## 25 B01001_025 B01001 Sex by Age Male: 85 years and over
## 26 B01001_026 B01001 Sex by Age Female:
## 27 B01001_027 B01001 Sex by Age Female: Under 5 years
## 28 B01001_028 B01001 Sex by Age Female: 5 to 9 years
## 29 B01001_029 B01001 Sex by Age Female: 10 to 14 years
## 30 B01001_030 B01001 Sex by Age Female: 15 to 17 years
## 31 B01001_031 B01001 Sex by Age Female: 18 and 19 years
## 32 B01001_032 B01001 Sex by Age Female: 20 years
## 33 B01001_033 B01001 Sex by Age Female: 21 years
## 34 B01001_034 B01001 Sex by Age Female: 22 to 24 years
## 35 B01001_035 B01001 Sex by Age Female: 25 to 29 years
## 36 B01001_036 B01001 Sex by Age Female: 30 to 34 years
## 37 B01001_037 B01001 Sex by Age Female: 35 to 39 years
## 38 B01001_038 B01001 Sex by Age Female: 40 to 44 years
## 39 B01001_039 B01001 Sex by Age Female: 45 to 49 years
## 40 B01001_040 B01001 Sex by Age Female: 50 to 54 years
## 41 B01001_041 B01001 Sex by Age Female: 55 to 59 years
## 42 B01001_042 B01001 Sex by Age Female: 60 and 61 years
## 43 B01001_043 B01001 Sex by Age Female: 62 to 64 years
## 44 B01001_044 B01001 Sex by Age Female: 65 and 66 years
## 45 B01001_045 B01001 Sex by Age Female: 67 to 69 years
## 46 B01001_046 B01001 Sex by Age Female: 70 to 74 years
## 47 B01001_047 B01001 Sex by Age Female: 75 to 79 years
## 48 B01001_048 B01001 Sex by Age Female: 80 to 84 years
## 49 B01001_049 B01001 Sex by Age Female: 85 years and over
acs.lookup(endyear=2012, span=1, table.number="B01001", keyword="Female")
## An object of class "acs.lookup"
## endyear= 2012 ; span= 1
##
## results:
## variable.code table.number table.name variable.name
## 1 B01001_026 B01001 Sex by Age Female:
## 2 B01001_027 B01001 Sex by Age Female: Under 5 years
## 3 B01001_028 B01001 Sex by Age Female: 5 to 9 years
## 4 B01001_029 B01001 Sex by Age Female: 10 to 14 years
## 5 B01001_030 B01001 Sex by Age Female: 15 to 17 years
## 6 B01001_031 B01001 Sex by Age Female: 18 and 19 years
## 7 B01001_032 B01001 Sex by Age Female: 20 years
## 8 B01001_033 B01001 Sex by Age Female: 21 years
## 9 B01001_034 B01001 Sex by Age Female: 22 to 24 years
## 10 B01001_035 B01001 Sex by Age Female: 25 to 29 years
## 11 B01001_036 B01001 Sex by Age Female: 30 to 34 years
## 12 B01001_037 B01001 Sex by Age Female: 35 to 39 years
## 13 B01001_038 B01001 Sex by Age Female: 40 to 44 years
## 14 B01001_039 B01001 Sex by Age Female: 45 to 49 years
## 15 B01001_040 B01001 Sex by Age Female: 50 to 54 years
## 16 B01001_041 B01001 Sex by Age Female: 55 to 59 years
## 17 B01001_042 B01001 Sex by Age Female: 60 and 61 years
## 18 B01001_043 B01001 Sex by Age Female: 62 to 64 years
## 19 B01001_044 B01001 Sex by Age Female: 65 and 66 years
## 20 B01001_045 B01001 Sex by Age Female: 67 to 69 years
## 21 B01001_046 B01001 Sex by Age Female: 70 to 74 years
## 22 B01001_047 B01001 Sex by Age Female: 75 to 79 years
## 23 B01001_048 B01001 Sex by Age Female: 80 to 84 years
## 24 B01001_049 B01001 Sex by Age Female: 85 years and over
acs.lookup(endyear=2012, span=1, keyword=c("Female", "GED"))
## An object of class "acs.lookup"
## endyear= 2012 ; span= 1
##
## results:
## variable.code table.number
## 1 B15001_047 B15001
## 2 B15001_055 B15001
## 3 B15001_063 B15001
## 4 B15001_071 B15001
## 5 B15001_079 B15001
## 6 B15002_028 B15002
## 7 B15002A_015 B15002A
## 8 B15002B_015 B15002B
## 9 B15002C_015 B15002C
## 10 B15002D_015 B15002D
## 11 B15002E_015 B15002E
## 12 B15002F_015 B15002F
## 13 B15002G_015 B15002G
## 14 B15002H_015 B15002H
## 15 B15002I_015 B15002I
## 16 C15001_031 C15001
## 17 C15001_036 C15001
## 18 C15001_041 C15001
## 19 C15001_046 C15001
## 20 C15001_051 C15001
## 21 C15002_013 C15002
## 22 C15002A_009 C15002A
## 23 C15002B_009 C15002B
## 24 C15002C_009 C15002C
## 25 C15002D_009 C15002D
## 26 C15002E_009 C15002E
## 27 C15002F_009 C15002F
## 28 C15002G_009 C15002G
## 29 C15002H_009 C15002H
## 30 C15002I_009 C15002I
## table.name
## 1 SEX BY AGE BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 18 YEARS AND OVER
## 2 SEX BY AGE BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 18 YEARS AND OVER
## 3 SEX BY AGE BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 18 YEARS AND OVER
## 4 SEX BY AGE BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 18 YEARS AND OVER
## 5 SEX BY AGE BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 18 YEARS AND OVER
## 6 Sex by Educational Attainment for the Population 25 Years and over
## 7 SEX BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 25 YEARS AND OVER (WHITE ALONE)
## 8 SEX BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 25 YEARS AND OVER (BLACK OR AFRICAN AMERICAN ALONE)
## 9 SEX BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 25 YEARS AND OVER (AMERICAN INDIAN AND ALASKA NATIVE ALONE)
## 10 SEX BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 25 YEARS AND OVER (ASIAN ALONE)
## 11 SEX BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 25 YEARS AND OVER (NATIVE HAWAIIAN AND OTHER PACIFIC ISLANDER ALONE)
## 12 SEX BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 25 YEARS AND OVER (SOME OTHER RACE ALONE)
## 13 SEX BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 25 YEARS AND OVER (TWO OR MORE RACES)
## 14 SEX BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 25 YEARS AND OVER (WHITE ALONE, NOT HISPANIC OR LATINO)
## 15 SEX BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 25 YEARS AND OVER (HISPANIC OR LATINO)
## 16 SEX BY AGE BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 18 YEARS AND OVER
## 17 SEX BY AGE BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 18 YEARS AND OVER
## 18 SEX BY AGE BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 18 YEARS AND OVER
## 19 SEX BY AGE BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 18 YEARS AND OVER
## 20 SEX BY AGE BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 18 YEARS AND OVER
## 21 Sex by Educational Attainment for the Population 25 Years and Over
## 22 Sex by Educational Attainment for the Population 25 Years and Over (White Alone)
## 23 Sex by Educational Attainment for the Population 25 Years and Over (Black or African American Alone)
## 24 Sex by Educational Attainment for the Population 25 Years and Over (American Indian and Alaska Native Alone)
## 25 Sex by Educational Attainment for the Population 25 Years and Over (Asian Alone)
## 26 Sex by Educational Attainment for the Population 25 Years and Over (Native Hawaiian and Other Pacific Islander Alone)
## 27 Sex by Educational Attainment for the Population 25 Years and Over (Some Other Race Alone)
## 28 Sex by Educational Attainment for the Population 25 Years and Over (Two or More Races)
## 29 Sex by Educational Attainment for the Population 25 Years and Over (White Alone, Not Hispanic or Latino)
## 30 Sex by Educational Attainment for the Population 25 Years and Over (Hispanic or Latino)
## variable.name
## 1 Female: 18 to 24 years: High school graduate, GED, or alternative
## 2 Female: 25 to 34 years: High school graduate, GED, or alternative
## 3 Female: 35 to 44 years: High school graduate, GED, or alternative
## 4 Female: 45 to 64 years: High school graduate, GED, or alternative
## 5 Female: 65 years and over: High school graduate, GED, or alternative
## 6 Female: High school graduate, GED, or alternative
## 7 Female: GED or alternative credential
## 8 Female: GED or alternative credential
## 9 Female: GED or alternative credential
## 10 Female: GED or alternative credential
## 11 Female: GED or alternative credential
## 12 Female: GED or alternative credential
## 13 Female: GED or alternative credential
## 14 Female: GED or alternative credential
## 15 Female: GED or alternative credential
## 16 Female: 18 to 24 years: High school graduate, GED, or alternative
## 17 Female: 25 to 34 years: High school graduate, GED, or alternative
## 18 Female: 35 to 44 years: High school graduate, GED, or alternative
## 19 Female: 45 to 64 years: High school graduate, GED, or alternative
## 20 Female: 65 years and over: High school graduate, GED, or alternative
## 21 Female: High school graduate, GED, or alternative
## 22 Female: High school graduate, GED, or alternative
## 23 Female: High school graduate, GED, or alternative
## 24 Female: High school graduate, GED, or alternative
## 25 Female: High school graduate, GED, or alternative
## 26 Female: High school graduate, GED, or alternative
## 27 Female: High school graduate, GED, or alternative
## 28 Female: High school graduate, GED, or alternative
## 29 Female: High school graduate, GED, or alternative
## 30 Female: High school graduate, GED, or alternative
acs.lookup(endyear=2000, dataset="sf3", table.number="P56")
## An object of class "acs.lookup"
## endyear= 2000 ; span= 0
##
## results:
## variable.code table.number
## 1 P056001 P56
## 2 P056002 P56
## 3 P056003 P56
## 4 P056004 P56
## 5 P056005 P56
## 6 P056006 P56
## 7 P056007 P56
## 8 P056008 P56
## table.name
## 1 P56. Median Household Income in 1999 (Dollars) by Age of Householder
## 2 P56. Median Household Income in 1999 (Dollars) by Age of Householder
## 3 P56. Median Household Income in 1999 (Dollars) by Age of Householder
## 4 P56. Median Household Income in 1999 (Dollars) by Age of Householder
## 5 P56. Median Household Income in 1999 (Dollars) by Age of Householder
## 6 P56. Median Household Income in 1999 (Dollars) by Age of Householder
## 7 P56. Median Household Income in 1999 (Dollars) by Age of Householder
## 8 P56. Median Household Income in 1999 (Dollars) by Age of Householder
## variable.name
## 1 Median household income in 1999 -- Total Households
## 2 Median household income in 1999 -- Householder under 25 years
## 3 Median household income in 1999 -- Householder 25 to 34 years
## 4 Median household income in 1999 -- Householder 35 to 44 years
## 5 Median household income in 1999 -- Householder 45 to 54 years
## 6 Median household income in 1999 -- Householder 55 to 64 years
## 7 Median household income in 1999 -- Householder 65 to 74 years
## 8 Median household income in 1999 -- Householder 75 years and over
acs.lookup(endyear=1990, dataset="sf3", table.number="H058")
## An object of class "acs.lookup"
## endyear= 1990 ; span= 0
##
## results:
## variable.code table.number table.name
## 1 H0580001 H058 Housing Subjects
## 2 H0580002 H058 Housing Subjects
## 3 H0580003 H058 Housing Subjects
## 4 H0580004 H058 Housing Subjects
## 5 H0580005 H058 Housing Subjects
## 6 H0580006 H058 Housing Subjects
## 7 H0580007 H058 Housing Subjects
## 8 H0580008 H058 Housing Subjects
## 9 H0580009 H058 Housing Subjects
## 10 H0580010 H058 Housing Subjects
## 11 H0580011 H058 Housing Subjects
## 12 H0580012 H058 Housing Subjects
## 13 H058A001 H058A Housing Subjects
## 14 H058A002 H058A Housing Subjects
## variable.name
## 1 With a mortgage: Less than 20 percent
## 2 With a mortgage: 20 to 24 percent
## 3 With a mortgage: 25 to 29 percent
## 4 With a mortgage: 30 to 34 percent
## 5 With a mortgage: 35 percent or more
## 6 With a mortgage: Not computed
## 7 Not mortgaged: Less than 20 percent
## 8 Not mortgaged: 20 to 24 percent
## 9 Not mortgaged: 25 to 29 percent
## 10 Not mortgaged: 30 to 34 percent
## 11 Not mortgaged: 35 percent or more
## 12 Not mortgaged: Not computed
## 13 With a mortgage
## 14 Not mortgaged
age.by.sex=acs.lookup(endyear=2014, span=5, table.name="Age by Sex")
# load ACS data
# load ACS data
data(kansas09)
# confidence intervals for select columns
confint(kansas09[20:25,], parm=c(4,5,10))
## $Universe...TOTAL.POPULATION..Male..5.to.9.years
## 2.5 % 97.5 %
## Decatur County, Kansas -2.744024 68.74402
## Dickinson County, Kansas 493.598306 772.40169
## Doniphan County, Kansas 119.915704 208.08430
## Douglas County, Kansas 2431.047808 3002.95219
## Edwards County, Kansas 60.213313 119.78669
## Elk County, Kansas 91.830378 156.16962
##
## $Universe...TOTAL.POPULATION..Male..10.to.14.years
## 2.5 % 97.5 %
## Decatur County, Kansas 92.25598 163.74402
## Dickinson County, Kansas 516.06657 813.93343
## Doniphan County, Kansas 270.95837 371.04163
## Douglas County, Kansas 2615.04781 3186.95219
## Edwards County, Kansas 114.06451 187.93549
## Elk County, Kansas 17.40478 74.59522
##
## $Universe...TOTAL.POPULATION..Male..22.to.24.years
## 2.5 % 97.5 %
## Decatur County, Kansas 12.2559760 83.74402
## Dickinson County, Kansas 214.1300460 473.86995
## Doniphan County, Kansas 132.7877157 185.21228
## Douglas County, Kansas 5475.9498977 6970.05010
## Edwards County, Kansas -0.3184264 78.31843
## Elk County, Kansas 8.4474434 77.55256
# another way to accomplish this
confint(kansas09[20:25,c(4,5,10)])
## $Universe...TOTAL.POPULATION..Male..5.to.9.years
## 2.5 % 97.5 %
## Decatur County, Kansas -2.744024 68.74402
## Dickinson County, Kansas 493.598306 772.40169
## Doniphan County, Kansas 119.915704 208.08430
## Douglas County, Kansas 2431.047808 3002.95219
## Edwards County, Kansas 60.213313 119.78669
## Elk County, Kansas 91.830378 156.16962
##
## $Universe...TOTAL.POPULATION..Male..10.to.14.years
## 2.5 % 97.5 %
## Decatur County, Kansas 92.25598 163.74402
## Dickinson County, Kansas 516.06657 813.93343
## Doniphan County, Kansas 270.95837 371.04163
## Douglas County, Kansas 2615.04781 3186.95219
## Edwards County, Kansas 114.06451 187.93549
## Elk County, Kansas 17.40478 74.59522
##
## $Universe...TOTAL.POPULATION..Male..22.to.24.years
## 2.5 % 97.5 %
## Decatur County, Kansas 12.2559760 83.74402
## Dickinson County, Kansas 214.1300460 473.86995
## Doniphan County, Kansas 132.7877157 185.21228
## Douglas County, Kansas 5475.9498977 6970.05010
## Edwards County, Kansas -0.3184264 78.31843
## Elk County, Kansas 8.4474434 77.55256
# store data and extract at will
my.conf <- confint(kansas09)
str(my.conf)
## List of 55
## $ Universe...TOTAL.POPULATION..Total :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 13403 7900 16469 4714 27654 ...
## ..$ 97.5 %: num [1:105] 13403 7900 16469 4714 27654 ...
## $ Universe...TOTAL.POPULATION..Male :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 6443 3854 7789 2281 13178 ...
## ..$ 97.5 %: num [1:105] 6717 3968 8061 2383 13448 ...
## $ Universe...TOTAL.POPULATION..Male..Under.5.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 374 260 467 117 883 ...
## ..$ 97.5 %: num [1:105] 424 286 537 131 887 ...
## $ Universe...TOTAL.POPULATION..Male..5.to.9.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 211.1 218.4 517.6 99.7 688.5 ...
## ..$ 97.5 %: num [1:105] 397 326 796 178 994 ...
## $ Universe...TOTAL.POPULATION..Male..10.to.14.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 486.3 262 387.5 90.9 839.5 ...
## ..$ 97.5 %: num [1:105] 670 374 642 167 1145 ...
## $ Universe...TOTAL.POPULATION..Male..15.to.17.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 269.9 180.4 369.1 -26.9 485.2 ...
## ..$ 97.5 %: num [1:105] 296 188 455 233 595 ...
## $ Universe...TOTAL.POPULATION..Male..18.and.19.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 109.73 61.43 72.37 -6.11 369.49 ...
## ..$ 97.5 %: num [1:105] 424.3 180.6 677.6 20.1 450.5 ...
## $ Universe...TOTAL.POPULATION..Male..20.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 9.11 16.62 21.15 -5.72 25.66 ...
## ..$ 97.5 %: num [1:105] 206.9 133.4 342.8 15.7 154.3 ...
## $ Universe...TOTAL.POPULATION..Male..21.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] -7.51 -4.34 53.62 22.62 35.7 ...
## ..$ 97.5 %: num [1:105] 73.5 12.3 282.4 139.4 288.3 ...
## $ Universe...TOTAL.POPULATION..Male..22.to.24.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 229 40.5 106.2 44.2 597 ...
## ..$ 97.5 %: num [1:105] 403 183 490 166 883 ...
## $ Universe...TOTAL.POPULATION..Male..25.to.29.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 465.1 163.3 434.8 60.6 750.5 ...
## ..$ 97.5 %: num [1:105] 538.9 184.7 487.2 65.4 769.5 ...
## $ Universe...TOTAL.POPULATION..Male..30.to.34.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 323.8 39.1 376.4 73.9 526.3 ...
## ..$ 97.5 %: num [1:105] 388.2 298.9 483.6 88.1 733.7 ...
## $ Universe...TOTAL.POPULATION..Male..35.to.39.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 185.1 186 391.4 87.1 617.4 ...
## ..$ 97.5 %: num [1:105] 333 348 611 185 911 ...
## $ Universe...TOTAL.POPULATION..Male..40.to.44.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 389.1 171 280.4 70.7 592 ...
## ..$ 97.5 %: num [1:105] 537 345 500 161 866 ...
## $ Universe...TOTAL.POPULATION..Male..45.to.49.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 466 173 536 192 1006 ...
## ..$ 97.5 %: num [1:105] 536 433 714 244 1194 ...
## $ Universe...TOTAL.POPULATION..Male..50.to.54.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 430 143 520 189 1033 ...
## ..$ 97.5 %: num [1:105] 468 403 612 239 1223 ...
## $ Universe...TOTAL.POPULATION..Male..55.to.59.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 448 277 388 117 794 ...
## ..$ 97.5 %: num [1:105] 590 389 626 219 1056 ...
## $ Universe...TOTAL.POPULATION..Male..60.and.61.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 56 11.4 92.4 60.1 132.9 ...
## ..$ 97.5 %: num [1:105] 168 80.6 261.6 157.9 333.1 ...
## $ Universe...TOTAL.POPULATION..Male..62.to.64.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 81.7 32 115.3 49.7 299.7 ...
## ..$ 97.5 %: num [1:105] 222 132 311 128 540 ...
## $ Universe...TOTAL.POPULATION..Male..65.and.66.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 36.5 61.2 56.7 23.4 181 ...
## ..$ 97.5 %: num [1:105] 129 171 185 131 343 ...
## $ Universe...TOTAL.POPULATION..Male..67.to.69.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 115.8 66.1 77.7 31.3 157.3 ...
## ..$ 97.5 %: num [1:105] 230 164 230 103 403 ...
## $ Universe...TOTAL.POPULATION..Male..70.to.74.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 170.7 66.1 142.6 83 376.1 ...
## ..$ 97.5 %: num [1:105] 299 164 297 145 562 ...
## $ Universe...TOTAL.POPULATION..Male..75.to.79.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 155.7 52.1 157.7 59.6 305.4 ...
## ..$ 97.5 %: num [1:105] 284 150 286 114 487 ...
## $ Universe...TOTAL.POPULATION..Male..80.to.84.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 87.6 53.4 49 12.3 248.7 ...
## ..$ 97.5 %: num [1:105] 192.4 160.6 149 83.7 439.3 ...
## $ Universe...TOTAL.POPULATION..Male..85.years.and.over :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 68.43 46.53 79.96 3.15 117.68 ...
## ..$ 97.5 %: num [1:105] 188 139 180 101 308 ...
## $ Universe...TOTAL.POPULATION..Female :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 6686 3932 8408 2331 14206 ...
## ..$ 97.5 %: num [1:105] 6960 4046 8680 2433 14476 ...
## $ Universe...TOTAL.POPULATION..Female..Under.5.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 372 233 437 108 887 ...
## ..$ 97.5 %: num [1:105] 432 291 545 112 999 ...
## $ Universe...TOTAL.POPULATION..Female..5.to.9.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 242.9 109.6 452 70.7 706.5 ...
## ..$ 97.5 %: num [1:105] 393 338 726 161 1012 ...
## $ Universe...TOTAL.POPULATION..Female..10.to.14.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 396 206 374 107 826 ...
## ..$ 97.5 %: num [1:105] 560 430 622 197 1148 ...
## $ Universe...TOTAL.POPULATION..Female..15.to.17.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 233 169 345 106 570 ...
## ..$ 97.5 %: num [1:105] 261 179 435 110 670 ...
## $ Universe...TOTAL.POPULATION..Female..18.and.19.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] -14 -16.7 301.1 -66.9 360.7 ...
## ..$ 97.5 %: num [1:105] 484 167 723 193 439 ...
## $ Universe...TOTAL.POPULATION..Female..20.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 38.24 -5.72 64.9 -3.32 133.05 ...
## ..$ 97.5 %: num [1:105] 159.8 15.7 315.1 75.3 481 ...
## $ Universe...TOTAL.POPULATION..Female..21.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 6.576 -129.87 28.98 0.788 19.491 ...
## ..$ 97.5 %: num [1:105] 223.4 129.9 191 53.2 212.5 ...
## $ Universe...TOTAL.POPULATION..Female..22.to.24.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 77.2 91.9 188.9 20.6 423.9 ...
## ..$ 97.5 %: num [1:105] 248.8 280.1 377.1 87.4 674.1 ...
## $ Universe...TOTAL.POPULATION..Female..25.to.29.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 403.7 152.4 410.5 44.6 701.6 ...
## ..$ 97.5 %: num [1:105] 444.3 209.6 441.5 87.4 856.4 ...
## $ Universe...TOTAL.POPULATION..Female..30.to.34.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 301.3 181.6 353.6 76.9 512.8 ...
## ..$ 97.5 %: num [1:105] 323 224 508 115 677 ...
## $ Universe...TOTAL.POPULATION..Female..35.to.39.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 289.4 135 449.5 98.8 537.8 ...
## ..$ 97.5 %: num [1:105] 471 297 704 163 826 ...
## $ Universe...TOTAL.POPULATION..Female..40.to.44.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 304 223 285 112 695 ...
## ..$ 97.5 %: num [1:105] 490 365 557 176 1011 ...
## $ Universe...TOTAL.POPULATION..Female..45.to.49.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 495 271 538 188 1066 ...
## ..$ 97.5 %: num [1:105] 533 301 666 258 1270 ...
## $ Universe...TOTAL.POPULATION..Female..50.to.54.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 476.3 126.1 526.5 68.1 1048.7 ...
## ..$ 97.5 %: num [1:105] 510 386 619 328 1189 ...
## $ Universe...TOTAL.POPULATION..Female..55.to.59.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 443 169 320 178 645 ...
## ..$ 97.5 %: num [1:105] 601 327 604 264 889 ...
## $ Universe...TOTAL.POPULATION..Female..60.and.61.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 79.96 19.26 66 3.75 207.53 ...
## ..$ 97.5 %: num [1:105] 180 90.7 178 44.3 412.5 ...
## $ Universe...TOTAL.POPULATION..Female..62.to.64.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 118.1 76.9 209.9 39.3 326.5 ...
## ..$ 97.5 %: num [1:105] 254 215 410 123 581 ...
## $ Universe...TOTAL.POPULATION..Female..65.and.66.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 111 60.6 39.7 10.1 203.1 ...
## ..$ 97.5 %: num [1:105] 235 177.4 168.3 33.9 400.9 ...
## $ Universe...TOTAL.POPULATION..Female..67.to.69.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 117.2 63.3 145.4 51.8 250.5 ...
## ..$ 97.5 %: num [1:105] 239 159 377 104 455 ...
## $ Universe...TOTAL.POPULATION..Female..70.to.74.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 173.5 92.6 273.5 112.6 406.8 ...
## ..$ 97.5 %: num [1:105] 305 209 416 167 621 ...
## $ Universe...TOTAL.POPULATION..Female..75.to.79.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 260.8 36 193 46.2 645.8 ...
## ..$ 97.5 %: num [1:105] 425 136 417 106 934 ...
## $ Universe...TOTAL.POPULATION..Female..80.to.84.years :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 191.7 144.7 156.4 26.1 313.4 ...
## ..$ 97.5 %: num [1:105] 394 335 338 174 483 ...
## $ Universe...TOTAL.POPULATION..Female..85.years.and.over :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 106.9 43.4 171.1 32.6 327.1 ...
## ..$ 97.5 %: num [1:105] 257 263 419 199 625 ...
## $ Universe...TOTAL.POPULATION.IN.THE.UNITED.STATES..Total :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 13403 7900 16469 4714 27654 ...
## ..$ 97.5 %: num [1:105] 13403 7900 16469 4714 27654 ...
## $ Universe...TOTAL.POPULATION.IN.THE.UNITED.STATES..U.S..citizen..born.in.the.United.States :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 13183 7815 16196 4635 25613 ...
## ..$ 97.5 %: num [1:105] 13369 7893 16390 4701 26259 ...
## $ Universe...TOTAL.POPULATION.IN.THE.UNITED.STATES..U.S..citizen..born.in.Puerto.Rico.or.U.S..Island.Areas:'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] -10.25 -129.87 -29.42 -129.87 -2.96 ...
## ..$ 97.5 %: num [1:105] 30.25 129.87 75.42 129.87 8.96 ...
## $ Universe...TOTAL.POPULATION.IN.THE.UNITED.STATES..U.S..citizen..born.abroad.of.American.parent.s. :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] 2.04 -1.57 10.49 3.28 42.6 ...
## ..$ 97.5 %: num [1:105] 125.96 5.57 91.51 24.72 209.4 ...
## $ Universe...TOTAL.POPULATION.IN.THE.UNITED.STATES..U.S..citizen.by.naturalization :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] -13.084 -2.063 1.384 -0.681 165.598 ...
## ..$ 97.5 %: num [1:105] 75.1 36.1 108.6 32.7 444.4 ...
## $ Universe...TOTAL.POPULATION.IN.THE.UNITED.STATES..Not.a.U.S..citizen :'data.frame': 105 obs. of 2 variables:
## ..$ 2.5 % : num [1:105] -18.51 -8.74 2.92 -10.21 945.62 ...
## ..$ 97.5 %: num [1:105] 62.5 62.7 91.1 42.2 1622.4 ...
my.conf[32]
## $Universe...TOTAL.POPULATION..Female..20.years
## 2.5 % 97.5 %
## Allen County, Kansas 38.235159 159.764841
## Anderson County, Kansas -5.723207 15.723207
## Atchison County, Kansas 64.895916 315.104084
## Barber County, Kansas -3.318426 75.318426
## Barton County, Kansas 133.045750 480.954250
## Bourbon County, Kansas 13.575431 118.424569
## Brown County, Kansas 8.021846 69.978154
## Butler County, Kansas 251.343359 570.656641
## Chase County, Kansas -129.869954 129.869954
## Chautauqua County, Kansas -7.872012 27.872012
## Cherokee County, Kansas 66.533798 271.466202
## Cheyenne County, Kansas -3.148805 11.148805
## Clark County, Kansas -2.574402 4.574402
## Clay County, Kansas -10.318426 68.318426
## Cloud County, Kansas -15.744024 55.744024
## Coffey County, Kansas -8.914675 14.914675
## Comanche County, Kansas -23.892829 61.892829
## Cowley County, Kansas 133.916733 334.083267
## Crawford County, Kansas 181.258034 476.741966
## Decatur County, Kansas -2.574402 4.574402
## Dickinson County, Kansas 17.043692 140.956308
## Doniphan County, Kansas 6.596248 61.403752
## Douglas County, Kansas 1878.306871 2857.693129
## Edwards County, Kansas -18.212284 34.212284
## Elk County, Kansas 2.745053 43.254947
## Ellis County, Kansas 329.111287 862.888713
## Ellsworth County, Kansas -2.680545 30.680545
## Finney County, Kansas 181.343359 500.656641
## Ford County, Kansas 169.194555 502.805445
## Franklin County, Kansas 54.917762 367.082238
## Geary County, Kansas 46.023904 331.976096
## Gove County, Kansas -7.723207 13.723207
## Graham County, Kansas -3.872012 31.872012
## Grant County, Kansas -5.148805 9.148805
## Gray County, Kansas -1.063479 37.063479
## Greeley County, Kansas -5.148805 9.148805
## Greenwood County, Kansas 16.064508 89.935492
## Hamilton County, Kansas -2.574402 4.574402
## Harper County, Kansas -7.872012 27.872012
## Harvey County, Kansas 120.236188 353.763812
## Haskell County, Kansas 3.170651 50.829349
## Hodgeman County, Kansas -2.765870 6.765870
## Jackson County, Kansas 7.830378 72.169622
## Jefferson County, Kansas 12.192496 121.807504
## Jewell County, Kansas -6.340272 10.340272
## Johnson County, Kansas 2584.242362 3489.757638
## Kearny County, Kansas -3.297610 25.297610
## Kingman County, Kansas -8.914675 14.914675
## Kiowa County, Kansas -67.699303 239.699303
## Labette County, Kansas 21.086354 156.913646
## Lane County, Kansas -129.869954 129.869954
## Leavenworth County, Kansas 222.300697 529.699303
## Lincoln County, Kansas -1.914675 21.914675
## Linn County, Kansas 6.021846 67.978154
## Logan County, Kansas -12.020817 38.020817
## Lyon County, Kansas 317.195584 762.804416
## McPherson County, Kansas 150.789774 427.210226
## Marion County, Kansas -20.785658 150.785658
## Marshall County, Kansas -1.978154 59.978154
## Meade County, Kansas -2.531740 16.531740
## Miami County, Kansas 16.809562 131.190438
## Mitchell County, Kansas -11.764841 109.764841
## Montgomery County, Kansas 83.108200 280.891800
## Morris County, Kansas -129.869954 129.869954
## Morton County, Kansas -5.148805 9.148805
## Nemaha County, Kansas -2.574402 4.574402
## Neosho County, Kansas -31.485990 335.485990
## Ness County, Kansas -8.297610 20.297610
## Norton County, Kansas -2.574402 4.574402
## Osage County, Kansas 15.255976 86.744024
## Osborne County, Kansas -4.361089 62.361089
## Ottawa County, Kansas -5.297610 23.297610
## Pawnee County, Kansas -129.869954 129.869954
## Phillips County, Kansas -16.212284 36.212284
## Pottawatomie County, Kansas -4.530711 126.530711
## Pratt County, Kansas -0.741966 294.741966
## Rawlins County, Kansas -1.531740 17.531740
## Reno County, Kansas 212.683632 515.316368
## Republic County, Kansas -33.467231 59.467231
## Rice County, Kansas -13.786687 45.786687
## Riley County, Kansas 1805.542030 2906.457970
## Rooks County, Kansas -1.872012 33.872012
## Rush County, Kansas -2.574402 4.574402
## Russell County, Kansas 5.809562 120.190438
## Saline County, Kansas 106.108200 303.891800
## Scott County, Kansas -17.935492 55.935492
## Sedgwick County, Kansas 2530.837581 3379.162419
## Seward County, Kansas 36.171680 195.828320
## Shawnee County, Kansas 508.684661 923.315339
## Sheridan County, Kansas -9.680545 23.680545
## Sherman County, Kansas -17.467231 75.467231
## Smith County, Kansas -2.574402 4.574402
## Stafford County, Kansas 14.553586 57.446414
## Stanton County, Kansas -5.106142 21.106142
## Stevens County, Kansas -2.574402 4.574402
## Sumner County, Kansas 14.873041 91.126959
## Thomas County, Kansas -60.359031 230.359031
## Trego County, Kansas -129.869954 129.869954
## Wabaunsee County, Kansas 11.873041 88.126959
## Wallace County, Kansas -129.869954 129.869954
## Washington County, Kansas 5.681574 84.318426
## Wichita County, Kansas -10.872012 24.872012
## Wilson County, Kansas 19.724236 110.275764
## Woodson County, Kansas -129.869954 129.869954
## Wyandotte County, Kansas 558.599335 949.400665
my.conf$Universe...TOTAL.POPULATION.IN.THE.UNITED.STATES..U.S..citizen.by.naturalization
## 2.5 % 97.5 %
## Allen County, Kansas -13.0842963 75.084296
## Anderson County, Kansas -2.0634795 36.063479
## Atchison County, Kansas 1.3839639 108.616036
## Barber County, Kansas -0.6805445 32.680545
## Barton County, Kansas 165.5983063 444.401694
## Bourbon County, Kansas -17.6795155 127.679516
## Brown County, Kansas 14.4047808 71.595219
## Butler County, Kansas 271.8959159 522.104084
## Chase County, Kansas -9.4464144 33.446414
## Chautauqua County, Kansas -3.5525566 65.552557
## Cherokee County, Kansas -6.6378819 38.637882
## Cheyenne County, Kansas -11.1696216 53.169622
## Clark County, Kansas -3.7232072 17.723207
## Clay County, Kansas 1.7242362 92.275764
## Cloud County, Kansas 0.7242362 91.275764
## Coffey County, Kansas 12.1071712 97.892829
## Comanche County, Kansas -4.5317397 14.531740
## Cowley County, Kansas 287.7262942 602.273706
## Crawford County, Kansas 250.4286846 593.571315
## Decatur County, Kansas -3.4464144 39.446414
## Dickinson County, Kansas 65.3839639 172.616036
## Doniphan County, Kansas 21.9157037 110.084296
## Douglas County, Kansas 1751.5816055 2528.418395
## Edwards County, Kansas 69.1071712 154.892829
## Elk County, Kansas -1.5744024 5.574402
## Ellis County, Kansas 14.6180941 131.381906
## Ellsworth County, Kansas -7.9146747 15.914675
## Finney County, Kansas 1759.7563722 3032.243628
## Ford County, Kansas 1230.2423622 2135.757638
## Franklin County, Kansas 2.8314074 179.168593
## Geary County, Kansas 997.3225425 1366.677458
## Gove County, Kansas -3.3402723 13.340272
## Graham County, Kansas -2.9573373 8.957337
## Grant County, Kansas 120.4713473 475.528653
## Gray County, Kansas 50.1498338 147.850166
## Greeley County, Kansas -15.0634795 23.063479
## Greenwood County, Kansas -5.0842963 83.084296
## Hamilton County, Kansas -5.3184264 73.318426
## Harper County, Kansas -1.7440240 69.744024
## Harvey County, Kansas 213.7262942 528.273706
## Haskell County, Kansas 57.3631471 214.636853
## Hodgeman County, Kansas -0.2976096 28.297610
## Jackson County, Kansas -1.7232072 19.723207
## Jefferson County, Kansas -2.0416336 98.041634
## Jewell County, Kansas 2.4682603 21.531740
## Johnson County, Kansas 14301.4035152 16536.596485
## Kearny County, Kansas 19.2351591 140.764841
## Kingman County, Kansas -0.7866867 58.786687
## Kiowa County, Kansas -1.4464144 41.446414
## Labette County, Kansas 6.4901061 87.509894
## Lane County, Kansas -1.7232072 19.723207
## Leavenworth County, Kansas 680.1310750 1051.868925
## Lincoln County, Kansas 2.8938579 29.106142
## Linn County, Kansas -2.3402723 14.340272
## Logan County, Kansas -129.8699540 129.869954
## Lyon County, Kansas 646.2413332 1439.758667
## McPherson County, Kansas 115.9385785 378.061421
## Marion County, Kansas 23.1071712 108.892829
## Marshall County, Kansas 4.1498338 101.850166
## Meade County, Kansas 27.8303784 92.169622
## Miami County, Kansas 58.6607567 187.339243
## Mitchell County, Kansas 0.2133133 59.786687
## Montgomery County, Kansas 73.7044484 326.295552
## Morris County, Kansas 7.2986386 90.701361
## Morton County, Kansas -2.1061421 24.106142
## Nemaha County, Kansas 0.3621181 45.637882
## Neosho County, Kansas 4.7242362 95.275764
## Ness County, Kansas 5.8303784 70.169622
## Norton County, Kansas -8.6378819 36.637882
## Osage County, Kansas 13.7877157 66.212284
## Osborne County, Kansas -2.8720120 32.872012
## Ottawa County, Kansas -7.2122843 45.212284
## Pawnee County, Kansas -9.6378819 35.637882
## Phillips County, Kansas -2.2976096 26.297610
## Pottawatomie County, Kansas 138.7887447 303.211255
## Pratt County, Kansas -25.8283203 133.828320
## Rawlins County, Kansas 1.0426627 12.957337
## Reno County, Kansas 499.4536175 1240.546382
## Republic County, Kansas 3.9791832 54.020817
## Rice County, Kansas 34.1924965 143.807504
## Riley County, Kansas 1020.7501981 1621.249802
## Rooks County, Kansas -1.4890771 29.489077
## Rush County, Kansas -1.0208168 49.020817
## Russell County, Kansas -129.8699540 129.869954
## Saline County, Kansas 494.8990029 1081.100997
## Scott County, Kansas -9.0634795 29.063479
## Sedgwick County, Kansas 12841.3348906 14554.665109
## Seward County, Kansas 1224.8781861 1861.121814
## Shawnee County, Kansas 2053.1996996 2946.800300
## Sheridan County, Kansas -11.8293494 35.829349
## Sherman County, Kansas -5.8917998 191.891800
## Smith County, Kansas -8.8293494 38.829349
## Stafford County, Kansas 13.7450530 54.254947
## Stanton County, Kansas 63.7034194 204.296581
## Stevens County, Kansas 66.0655375 251.934462
## Sumner County, Kansas 27.7887447 192.211255
## Thomas County, Kansas -8.0842963 80.084296
## Trego County, Kansas -3.6378819 41.637882
## Wabaunsee County, Kansas 6.0218458 67.978154
## Wallace County, Kansas -5.2976096 23.297610
## Washington County, Kansas 6.7450530 47.254947
## Wichita County, Kansas -3.1061421 23.106142
## Wilson County, Kansas -4.4890771 26.489077
## Woodson County, Kansas -9.4464144 33.446414
## Wyandotte County, Kansas 2874.9457816 3921.054218
# try a different value for level
confint(kansas09[1:10,6], level=.75)
## $Universe...TOTAL.POPULATION..Male..15.to.17.years
## 12.5 % 87.5 %
## Allen County, Kansas 275.30769 290.6923
## Anderson County, Kansas 181.90210 186.0979
## Atchison County, Kansas 386.82518 437.1748
## Barber County, Kansas 26.77624 179.2238
## Barton County, Kansas 507.83218 572.1678
## Bourbon County, Kansas 342.02798 397.9720
## Brown County, Kansas 214.62238 259.3776
## Butler County, Kansas 1572.24477 1661.7552
## Chase County, Kansas 68.11889 105.8811
## Chautauqua County, Kansas 74.31469 103.6853
# ... or a one-sided confidence interval
confint(kansas09[1:10,6], level=.75, alternative="greater")
## $Universe...TOTAL.POPULATION..Male..15.to.17.years
## 25 % 100 %
## Allen County, Kansas 278.48973 Inf
## Anderson County, Kansas 182.76993 Inf
## Atchison County, Kansas 397.23913 Inf
## Barber County, Kansas 58.30737 Inf
## Barton County, Kansas 521.13889 Inf
## Bourbon County, Kansas 353.59903 Inf
## Brown County, Kansas 223.87923 Inf
## Butler County, Kansas 1590.75845 Inf
## Chase County, Kansas 75.92935 Inf
## Chautauqua County, Kansas 80.38949 Inf
confint(kansas09[1:10,29], level=.75, alternative="less")
## $Universe...TOTAL.POPULATION..Female..10.to.14.years
## 0 % 75 %
## Allen County, Kansas -Inf 506.29167
## Anderson County, Kansas -Inf 356.54227
## Atchison County, Kansas -Inf 540.64251
## Barber County, Kansas -Inf 167.58092
## Barton County, Kansas -Inf 1042.35326
## Bourbon County, Kansas -Inf 585.75181
## Brown County, Kansas -Inf 437.06159
## Butler County, Kansas -Inf 2452.48551
## Chase County, Kansas -Inf 100.89070
## Chautauqua County, Kansas -Inf 95.48068
data(kansas09)[[1]]
## [1] "kansas09"
# state_choropleth_acs("B01003", endyear=2012, span=5)
geo.lookup(state="WA", county="Ska", county.subdivision="oo")
## state state.name county county.name county.subdivision
## 1 53 Washington NA <NA> NA
## 2 53 Washington 57 Skagit County NA
## 3 53 Washington 59 Skamania County NA
## 4 53 Washington 57 Skagit County 92944
## 5 53 Washington 59 Skamania County 90424
## county.subdivision.name
## 1 <NA>
## 2 <NA>
## 3 <NA>
## 4 Sedro-Woolley CCD
## 5 Carson-Underwood CCD
geo.lookup(state="WA", county="Kit", place="Ra")
## state state.name county county.name place place.name
## 1 53 Washington NA <NA> NA <NA>
## 2 53 Washington 35 Kitsap County NA <NA>
## 3 53 Washington 37 Kittitas County NA <NA>
## 4 53 Washington NA Pierce County 57140 Raft Island CDP
## 5 53 Washington NA Thurston County 57220 Rainier city
## 6 53 Washington NA King County 57395 Ravensdale CDP
## 7 53 Washington NA Pacific County 57430 Raymond city
# find all counties in WA or OR with capital M or B in name
geo.lookup(state=c("WA", "OR"), county=c("M","B"))
## state state.name county county.name
## 1 53 Washington NA <NA>
## 2 53 Washington 5 Benton County
## 3 53 Washington 45 Mason County
## 4 41 Oregon NA <NA>
## 5 41 Oregon 1 Baker County
## 6 41 Oregon 3 Benton County
## 7 41 Oregon 45 Malheur County
## 8 41 Oregon 47 Marion County
## 9 41 Oregon 49 Morrow County
## 10 41 Oregon 51 Multnomah County
# find all unified school districts in Kansas with "Ma" in name
geo.lookup(state="KS", school.district.unified="Ma")
## state state.name school.district.unified
## 1 20 Kansas NA
## 2 20 Kansas 16
## 3 20 Kansas 9060
## 4 20 Kansas 9090
## 5 20 Kansas 9140
## 6 20 Kansas 9180
## 7 20 Kansas 9240
## 8 20 Kansas 9480
## 9 20 Kansas 9660
## school.district.unified.name
## 1 <NA>
## 2 Marysville Unified School District 364
## 3 Macksville Unified School District 351
## 4 Madison-Virgil Unified School District 386
## 5 Maize Unified School District 266
## 6 Manhattan Unified School District 383
## 7 Marion-Florence Unified School District 408
## 8 Marais des Cygnes Valley Unified School District 456
## 9 Marmaton Valley Unified School District 256
## school.district.unified.type
## 1 <NA>
## 2 Unified
## 3 Unified
## 4 Unified
## 5 Unified
## 6 Unified
## 7 Unified
## 8 Unified
## 9 Unified
# find all american indian areas with "Hop" in name
geo.lookup(american.indian.area="Hop")
## american.indian.area american.indian.area.name
## 1 1505 Hopi Reservation and Off-Reservation Trust Land
## 2 1515 Hopland Rancheria and Off-Reservation Trust Land
## 3 7250 Point Hope ANVSA
To obtain specific information about these populations
suppressPackageStartupMessages(suppressWarnings(choroplethr_acs(tableId="B19301",map = "state")))
county_choropleth_acs(tableId="B19301", endyear = 2013, span = 5, num_colors = 7,
state_zoom = NULL, county_zoom = NULL)
county_choropleth_acs(tableId="B19301", endyear = 2013, span = 5, num_colors = 0,
state_zoom = NULL, county_zoom = NULL)
data(county.regions)
head(county.regions)
## region county.fips.character county.name state.name
## 1 1001 01001 autauga alabama
## 36 1003 01003 baldwin alabama
## 55 1005 01005 barbour alabama
## 15 1007 01007 bibb alabama
## 2 1009 01009 blount alabama
## 16 1011 01011 bullock alabama
## state.fips.character state.abb
## 1 01 AL
## 36 01 AL
## 55 01 AL
## 15 01 AL
## 2 01 AL
## 16 01 AL
suppressPackageStartupMessages(suppressWarnings(choroplethr_acs(tableId="B19301",map = "county")))
county.regions$value = county.regions$percent_black
county_choropleth_acs(tableId="B19301", endyear = 2013, span = 5, num_colors = 7,
state_zoom = NULL, county_zoom = NULL)
#
# data(df_county_demographics)
# head(df_county_demographics)
# df_county_demographics$value = df_county_demographics$county.name
# county_choropleth(df_county_demographics,
# state_zoom = "texas",
# title = "Texas County Percent percent_black2012 Estimates",
# num_colors = 9,reference_map = TRUE) + coord_map()
#
#
#
#choroplethr_acs(tableId="B19301",map = "zip")
data(df_pop_state)
#suppressPackageStartupMessages(suppressWarnings(choroplethr_acs("B19301", "county", buckets=1, zoom=c("new york", "new jersey", "connecticut"))))
state_choropleth(df=df_pop_state, title = "", legend = "", num_colors = 7,
zoom = c("new york", "new jersey", "connecticut"), reference_map = TRUE)
state_choropleth(df_pop_state,
title = "US 2012 State Population Estimates",
legend = "Population",
num_colors = 1,
zoom = c("california", "oregon", "washington","nevada","idaho"))
Population by state
state_choropleth(df=df_pop_state, title = "", legend = "", num_colors = 7)
head(economics)
## # A tibble: 6 x 6
## date pce pop psavert uempmed unemploy
## <date> <dbl> <int> <dbl> <dbl> <int>
## 1 1967-07-01 507.4 198712 12.5 4.5 2944
## 2 1967-08-01 510.5 198911 12.5 4.7 2945
## 3 1967-09-01 516.3 199113 11.7 4.6 2958
## 4 1967-10-01 512.9 199311 12.5 4.9 3143
## 5 1967-11-01 518.1 199498 12.5 4.7 3066
## 6 1967-12-01 525.8 199657 12.1 4.8 3018
data(df_state_age_2015)
df=data(df_state_age_2015)
cali_stats = get_tract_demographics("california")
head(cali_stats)
## region total_population percent_white percent_black percent_asian
## 1 6001400100 3353 64 5 20
## 2 6001400200 1944 70 2 10
## 3 6001400300 5376 65 14 11
## 4 6001400400 4152 60 14 8
## 5 6001400500 3618 47 28 5
## 6 6001400600 1691 32 40 6
## percent_hispanic per_capita_income median_rent median_age
## 1 8 86836 2001 47.4
## 2 11 86761 1437 45.5
## 3 7 53030 1038 39.7
## 4 11 51200 1461 37.0
## 5 15 37778 1145 34.4
## 6 13 32651 966 34.3
#suppressPackageStartupMessages(suppressWarnings(choroplethr_acs("B19301", "county", num_colors=1, zoom=c( "california"))))
#state_choropleth(df , num_colors = 7,
# state_zoom = "california", reference_map = TRUE)
#choroplethr_acs(tableId="B19301",map = "state")
#choroplethr_acs(tableId="B04004", map="state", endyear = 2015, span = 5, buckets = 7,zoom = NULL)
#selection :76
# pdf("/Users/nanaakwasiabayieboateng/Documents/memphisclassesbooks/DataMiningscience/Maps/Ghana1.pdf")
# choroplethr_acs(tableId="B04004", map="state", endyear = 2015, span = 5, buckets = 7,
# zoom = NULL)
#
# dev.off();
#selection:76
# pdf("/Users/nanaakwasiabayieboateng/Documents/memphisclassesbooks/DataMiningscience/Maps/Ghana2.pdf")
# choroplethr_acs(tableId="B04004", map="county", endyear = 2015, span = 5, buckets = 7,
# zoom = NULL)
# dev.off();
suppressPackageStartupMessages(suppressWarnings(choroplethr_acs("B19301", "county", num_colors=0, zoom=c( "new york"))))
df = data.frame(region=state.abb, value=sample(100, 50))
#state_choropleth(df, buckets = 7, zoom = NULL)
data(df_pop_state)
DT::datatable(head(df_pop_state))
state_choropleth(df_pop_state,
title="US 2012 State Population Estimates",
legend="Population",
num_colors=7,
zoom=c("california", "oregon", "washington","nevada"),
reference_map=TRUE)
suppressPackageStartupMessages(suppressWarnings(state_choropleth(df_pop_state,
title="US 2012 State Population Estimates",
legend="Population",
num_colors=7,
zoom=c("california", "oregon", "washington","nevada"))))
suppressPackageStartupMessages(suppressWarnings(choroplethr_acs("B19301", "county", buckets=1, zoom=c( "new york"))
))
suppressPackageStartupMessages(suppressWarnings(choroplethr_acs(tableId="B19301", map="zip",buckets=7,endyear = 2015)
))
Per capita income of Tennessee in 2015.
#choroplethr_acs(tableId="B19301", map="zip",buckets=7,endyear = 2015,zoom = "tennessee")
suppressPackageStartupMessages(suppressWarnings(choroplethr_acs(tableId="B19301", map="zip",buckets=7,endyear = 2015,zoom = "tennessee")
))
# library(choroplethrZip)
# data(df_pop_zip)
# zip_choropleth(df_pop_zip, state_zoom = "new york", title="Population of New York State by county") + coord_map()
#
#suppressPackageStartupMessages(suppressWarnings())+ coord_map()
#data(county.fips, package="maps")
#df = data.frame(region=county.fips$fips, value=sample(100, nrow(county.fips), replace=TRUE))
#head(df)
#choroplethr(df, lod="county", num_buckets=2)
#state_choropleth(df,values=df$values, buckets = 7, zoom = NULL)
library(choroplethr)
library(mapproj)
data(df_county_demographics)
head(df_county_demographics)
## region total_population percent_white percent_black percent_asian
## 1 1001 54907 76 18 1
## 2 1003 187114 83 9 1
## 3 1005 27321 46 46 0
## 4 1007 22754 75 22 0
## 5 1009 57623 88 1 0
## 6 1011 10746 22 71 0
## percent_hispanic per_capita_income median_rent median_age
## 1 2 24571 668 37.5
## 2 4 26766 693 41.5
## 3 5 16829 382 38.3
## 4 2 17427 351 39.4
## 5 8 20730 403 39.6
## 6 6 18628 276 39.6
df_county_demographics$value = df_county_demographics$percent_black
county_choropleth(df_county_demographics,
state_zoom = "texas",
title = "Texas County Percent percent_black2012 Estimates",
num_colors = 9,reference_map = TRUE) + coord_map()
#==================================================================
# Stop Cluster
#
#==================================================================
stopCluster(cluster)