<iframe src="https://exploratory.io/viz/kanaugust/3126356626076554?embed=true" frameborder="0" width="100%" height="100%" > </iframe>
# Set libPaths.
.libPaths("/Users/kannishida/.exploratory/R/3.3")
# Load required packages.
library(janitor)
library(lubridate)
library(hms)
library(tidyr)
library(urltools)
library(stringr)
library(readr)
library(broom)
library(RcppRoll)
library(tibble)
library(dplyr)
library(exploratory)
# Data Analysis Steps
exploratory::read_delim_file("/Users/kannishida/Downloads/Birthplace_ethnicgroup.csv" , ",", quote = "\"", skip = 0 , col_names = TRUE , na = c("","NA") , locale=locale(encoding = "ASCII", decimal_mark = "."), trim_ws = FALSE , progress = FALSE) %>%
exploratory::clean_data_frame() %>%
filter(!is.na(Value)) %>%
filter(Birthplace == "Total people, birthplace" & `Ethnic group` %nin% c("Not elsewhere included", "Total people stated", "Total people,other ethnicity", "Total people, ethnic group")) %>%
filter(str_detect(Area, "Region") & Area != "Area Outside Region") %>%
filter(!str_detect(Area, "^Oceanic") & !str_detect(Area, "^Total,")) %>%
group_by(Area) %>%
mutate(ratio = Value / sum(Value)) %>%
filter(`Ethnic group` == "Maori")This chart shows the proportion of Maori ethnical background population for each Region in New Zealand. We can see that the north east side of the country has higher concentration of Maori folks.
The population data is downloaded from Statistics New Zealand (http://nzdotstat.stats.govt.nz/wbos/Index.aspx#). The boundary data is originally downloaded from Statistics New Zealand (http://www.stats.govt.nz/browse_for_stats/Maps_and_geography/Geographic-areas/digital-boundary-files.aspx) and converted to GeoJSON.