-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish_indians.Rmd
92 lines (68 loc) · 4.13 KB
/
publish_indians.Rmd
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
American Indians vs Indian Americans, statewide population using googleVis
========================================================
The population of Native Americans in the United States is estimated to be anywhere upto [20 million] (http://en.wikipedia.org/wiki/Native_Americans_in_the_United_States). I wanted to find out what the population of Native Americans (originally referred to as American Indians by immigrants) is and compare it to the number of Indians from India (Indian Americans).
I wanted to do this comparison by county, but the US Census Bureau and other Federal websites are unavailable because of the Government shutdown (as of Oct 7 2013). Hence I obtained state-wide totals of American Indians and Indian Americans from several sources and made the below maps using R and googleVis.
**Data** -
* State-wide population of American Indians in 2010 - [wikipedia](http://en.wikipedia.org/wiki/Native_Americans_in_the_United_States)
* State-wide population totals of US states in 2010 - [wikipedia](http://en.wikipedia.org/wiki/List_of_U.S._states_and_territories_by_population)
* State-wide population totals of Indian Americans in 2010 - [news article](http://www.indiawest.com/news/3783-analysis-of-the-indian-american-community-from-census-2010-data.html)
First, I copied the data into a spreadsheet and cleaned it up and saved into a text file called "pop_indians.txt".
```{r}
# read data
pop_data <- read.delim("pop_indians.txt", as.is = TRUE)
head(pop_data)
```
Next, I estimated the number of Indian Americans and American Indians as number per 1000 of the total population of each state.
```{r}
# calculate number per 1000 of total population
pop_data$Indian_American <- sprintf("%.1f", pop_data$Pop_IndAm * 1000
/ pop_data$Tot_Pop)
pop_data$American_Indian <- sprintf("%.1f", pop_data$Pop_AmInd * 1000
/ pop_data$Tot_Pop)
head(pop_data)
```
Next, make some maps using googleVis.
```{r, results = 'asis'}
# load libraries
library(knitr)
suppressPackageStartupMessages(library(googleVis))
```
American Indians, per 1000 people
-----------------
```{r, results = 'asis'}
# plot american indians
chart_1 <- gvisGeoChart(data = pop_data,
locationvar = "State",
colorvar = "American_Indian",
options = list(region = "US",
displayMode = "regions",
resolution = "provinces",
colorAxis = "{minValue: 0, maxValue: 150, colors:['grey', 'black', 'green', 'blue', 'violet']}",
width = 600,
height = 400),
chartid = "AmInd")
plot(chart_1, "chart")
```
Indian Americans, per 1000 people
-----------------
```{r, results = 'asis'}
# plot indian americans
chart_2 <- gvisGeoChart(data = pop_data,
locationvar = "State",
colorvar = "Indian_American",
options = list(region = "US",
displayMode = "regions",
resolution = "provinces",
colorAxis = "{minValue: 0, maxValue: 150, colors:['grey', 'black', 'green', 'blue', 'violet']}",
width = 600,
height = 400),
chartid = "IndAm")
plot(chart_2, "chart")
```
In states with big cities, the number of Indian Americans are more than the American Indians. Moreover, I am not sure whether the statewide totals include or exclude the Indian immigrants who are not citizens of the United States. Also, the spatial patterns at the county resolution are likely going to be different. Only when the Census Bureau websites are back online I can dig into this a little deeper.
Here is the data in a tabluar format.
```{r, results = 'asis'}
chart_3 <- gvisTable(data = pop_data)
print(chart_3, "chart")
```
All relevant files are on my [GitHub site](https://github.com/RationShop/indians)