FOr this week’s assignment, I will be using the 2010 U.S. Religion Data (InfoGroup) obtained from Social Explorer. The dataset explores religion in every county and state in the country. Religion enables people to get a better understanding of how the world works.I want to see the prevalance of religion by county and state.
religion2010 <- read_csv("C:/Users/wroni/OneDrive/Documents/QC MADASR/SOC 712/religion2010.csv")
religion2010=religion2010%>%
rename("GEOID"="FIPS")
religion2010$GEOID=parse_integer(religion2010$GEOID)
countymap$GEOID=parse_integer(countymap$GEOID)
combineddata=left_join(countymap,religion2010,by="GEOID")
USA =combineddata %>%
filter(STATEFP != "02") %>%
filter(STATEFP != "15") %>%
filter(STATEFP != "60") %>%
filter(STATEFP != "66") %>%
filter(STATEFP != "69") %>%
filter(STATEFP != "72") %>%
filter(STATEFP != "78")
state_border=USA%>%
aggregate_map(by="STATEFP")
The following shows spatial and non-spatial approach to the same data. The map (spatial) ables us to see which areas of the US Protestants reside in. The plot (non-spatial) ables us to see prevalence of Protestants by state, however, we cannot get a visual representation of where those states are.
The visualizations show that Protestants mostly reside in Texas, Puerto Rico, Georgia, Virgina, and Kentucky. Protestants are mainly in the south.
protestantmap <- tm_shape(USA, projection = 2163) + tm_polygons("Total Mainline Protestant Member Count", title= "Percent Protestants", palette= "Oranges", showNA = TRUE, border.col = "gray50", border.alpha = .4) + tm_shape(USA) + tm_borders(lwd = .36, col = "black", alpha= 1) + tm_layout(main.title = "Prevalence of Protestants in the US (2010)")
protestantmap
ggplot((religion2010), aes(x=Sate_Name,y=`Total Mainline Protestant Member Count`)) + geom_bar(fill="orange",stat="identity") +coord_flip()
The visualizations show that Catholics mostly reside in Texas, Puerto Rico, Virgina, Kentucky, and Kansas. We can see that Cathlics and Protestants tend to reside in the same areas, in the south.
catholicmap <- tm_shape(USA, projection = 2163) + tm_polygons("Total Roman Catholic Member Count", title= "Percent Catholics", palette= "Oranges", showNA = TRUE, border.col = "gray50", border.alpha = .4) + tm_shape(USA) + tm_borders(lwd = .36, col = "black", alpha= 1) + tm_layout(main.title = "Prevalence of Catholics in the US (2010)")
catholicmap
ggplot((religion2010), aes(x=Sate_Name,y=`Total Roman Catholic Member Count`)) + geom_bar(fill="orange",stat="identity") +coord_flip()
The visualizations show that Jews mostly reside in Puetro Rico, Pennsylvania, New York, and California. Jews tend to reside in liberal states, both East and West.
jewishmap <- tm_shape(USA, projection = 2163) + tm_polygons("Total Jewish Member Count", title= "Percent Jewish", palette= "Oranges", showNA = TRUE, border.col = "gray50", border.alpha = .4) + tm_shape(USA) + tm_borders(lwd = .36, col = "black", alpha= 1) + tm_layout(main.title = "Prevalence of Jews in the US (2010)")
jewishmap
ggplot((religion2010), aes(x=Sate_Name,y=`Total Jewish Member Count`)) + geom_bar(fill="orange",stat="identity") +coord_flip()
The visualizations show that Muslims reside in Puetro Rico, Texas, California, and Flordia. Similar to the Jews, Muslims tend to reside in both East and West.
islammap <- tm_shape(USA, projection = 2163) + tm_polygons("Total Islamic Member Count", title= "Percent Islam", palette= "Oranges", showNA = TRUE, border.col = "gray50", border.alpha = .4) + tm_shape(USA) + tm_borders(lwd = .36, col = "black", alpha= 1) + tm_layout(main.title = "Prevalence of Muslims in the US (2010)")
islammap
ggplot((religion2010), aes(x=Sate_Name,y=`Total Islamic Member Count`)) + geom_bar(fill="orange",stat="identity") +coord_flip()
The following shows the scenario if cb = FALSE instead of cb = TRUE. For the cb = TRUE map (above in “Prevalence of Protestants in the US” section), it is little more spaced out than cb = FALSE map. We are able to see more in cb = TRUE.
religion2010 <- read_csv("C:/Users/wroni/OneDrive/Documents/QC MADASR/SOC 712/religion2010.csv")
religion2010=religion2010%>%
rename("GEOID"="FIPS")
religion2010$GEOID=parse_integer(religion2010$GEOID)
countymap$GEOID=parse_integer(countymap$GEOID)
combineddata=left_join(countymap,religion2010,by="GEOID")
USA =combineddata %>%
filter(STATEFP != "02") %>%
filter(STATEFP != "15") %>%
filter(STATEFP != "60") %>%
filter(STATEFP != "66") %>%
filter(STATEFP != "69") %>%
filter(STATEFP != "72") %>%
filter(STATEFP != "78")
state_border=USA%>%
aggregate_map(by="STATEFP")
protestantmap2 <- tm_shape(USA, projection = 2163) + tm_polygons("Total Mainline Protestant Member Count", title= "Percent Protestants", palette= "Oranges", showNA = TRUE, border.col = "gray50", border.alpha = .4) + tm_shape(USA) + tm_borders(lwd = .36, col = "black", alpha= 1) + tm_layout(main.title = "Prevalence of Protestants in the US (2010)")
protestantmap2