Created
October 25, 2017 12:10
-
-
Save fauxneticien/cb19b958b8cf3cfcf7a0d0ee62ac3e60 to your computer and use it in GitHub Desktop.
Visualise number of speakers of Australian languages in R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| library(leaflet) | |
| lang_dialects <- read_csv( | |
| # CSV file of languages with region, latitude and longitude | |
| file = "https://git.io/vFeOj" | |
| ) | |
| abs_2016 <- read_csv( | |
| # CSBV file of ABS 2016 census data with language names and number of speakers | |
| file = "https://git.io/vFe3e", | |
| skip = 11, | |
| n_max = 1427, | |
| col_names = c("INGP", "LANP4", "Persons", "X4"), | |
| col_types = "ccic" | |
| ) | |
| lang_geo_speakers <- left_join( | |
| x = lang_dialects %>% | |
| filter(macroarea == "Australia") %>% | |
| select(language = name, | |
| longitude, | |
| latitude), | |
| y = abs_2016 %>% | |
| group_by(LANP4) %>% | |
| summarise(speakers = sum(Persons)) %>% | |
| rename(language = LANP4), | |
| by = "language" | |
| ) | |
| lang_geo_speakers %>% | |
| leaflet() %>% | |
| addTiles() %>% | |
| addCircleMarkers( | |
| label = ~ as.character(paste0(language, ": ", speakers)), | |
| color = ~ ifelse(is.na(speakers), "red", "green") | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment