forked from sverhees/master_villages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
216 lines (216 loc) · 7.45 KB
/
.Rhistory
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
setwd("/Git/master_villages")
setwd("home/samira/Git/master_villages")
setwd("home/Samira/Git/master_villages")
getwd()
setwd("home/samira/Git/master_villages")
setwd("/home/samira/Git/master_villages")
library(tidyverse)
library(lingtypology)
villages <- read_tsv("villages.csv")
villages <- read_tsv("data/villages.csv")
meta <- read_tsv("data/meta.csv")
vill_meta <- merge(villages, meta, by = "lang")
core <- meta %>%
filter(core == "yes")
vill_core <- merge(villages, core, by = "lang")
turkic <- vill_core %>%
filter(aff == "Turkic")
turkic <- vill_core %>%
filter(family == "Turkic")
map.feature(lang.gltc(turkic$glottocode),
features = turkic$lang,
color = turkic$lang_color,
latitude = turkic$lat,
longitude = turkic$lon,
tile = c("Esri.WorldGrayCanvas"))
turkic$lang <- factor(turkic$lang, levels = c("Nogai, Kumyk, Azerbaijani"))
map.feature(lang.gltc(turkic$glottocode),
features = turkic$lang,
color = turkic$lang_color,
latitude = turkic$lat,
longitude = turkic$lon,
tile = c("Esri.WorldGrayCanvas"))
turkic$lang <- factor(turkic$lang, levels = c("Nogai, Kumyk, Azerbaijani"))
map.feature(lang.gltc(turkic$glottocode),
features = turkic$lang,
color = turkic$lang_color,
latitude = turkic$lat,
longitude = turkic$lon,
tile = c("Esri.WorldGrayCanvas"))
unique(turkic$lang)
turkic$lang <- factor(turkic$lang, levels = c("Nogai, Kumyk, Azerbaijani"))
map.feature(lang.gltc(turkic$glottocode),
features = turkic$lang,
color = turkic$lang_color,
latitude = turkic$lat,
longitude = turkic$lon,
tile = c("Esri.WorldGrayCanvas"))
turkic <- vill_core %>%
filter(family == "Turkic")
map.feature(lang.gltc(turkic$glottocode),
features = turkic$lang,
color = turkic$lang_color,
latitude = turkic$lat,
longitude = turkic$lon,
tile = c("Esri.WorldGrayCanvas"))
turkic$lang <- factor(turkic$lang, levels = c("Nogai, Kumyk, Azerbaijani"))
map.feature(lang.gltc(turkic$glottocode),
features = turkic$lang,
color = turkic$lang_color,
latitude = turkic$lat,
longitude = turkic$lon,
tile = c("Esri.WorldGrayCanvas"))
turkic <- vill_core %>%
filter(family == "Turkic")
map.feature(lang.gltc(turkic$glottocode),
features = turkic$lang,
color = turkic$lang_color,
title = "Language",
latitude = turkic$lat,
longitude = turkic$lon,
tile = c("Esri.WorldGrayCanvas"))
knitr::opts_chunk$set(echo = TRUE)
vill_meta_kutans <- vill_meta %>%
mutate(
kutanlang = case_when(
kutans == FALSE ~ lang,
TRUE ~ "kutan"
)
)
knitr::opts_chunk$set(echo = TRUE)
# packages
library(tidyverse) # data manipulation
library(lingtypology) # drawing maps
# load data
vill <- read_tsv("data/villages.csv") # dataframe with all villages, coordinates and languages
meta <- read_tsv("data/meta.csv") # dataframe with language metadata and color schemes
# data preparation
vill <- vill[complete.cases(vill$lat),] # remove villages without coordinates
meta_core <- meta %>% # remove idioms not (yet) recognized as distinct
filter(core == "yes")
vill_meta <- merge(vill, meta_core, by = "lang") # merge villages with metadata
vill_meta_kutans <- vill_meta %>%
mutate(
kutanlang = case_when(
kutans == FALSE ~ lang,
TRUE ~ "kutan"
)
)
View(vill_meta_kutans)
vill_meta_kutans <- vill_meta %>%
mutate(
kutanlang = case_when(
kutans == FALSE ~ lang,
TRUE ~ "Kutan")) %>%
mutate(
kutancolor = case_when(
kutans == FALSE ~ lang_color,
TRUE ~ "white"))
vill_meta_kutans <- vill_meta %>%
mutate(
kutanlang = case_when(
kutans == FALSE ~ lang,
TRUE ~ "Kutan")) %>%
mutate(
kutancolor = case_when(
kutans == FALSE ~ lang_color,
TRUE ~ "white"))
# re-order the elements in the legend (by default they are in alphabetical order)
vill_meta$lang <- factor(vill_meta$lang, levels =c(
"Dargwa", "Lak", "Bats", "Ingush", "Chechen", "Khinalug", "Archi", "Tsakhur", "Rutul", "Kryz", "Budukh", "Udi", "Lezgian", "Agul", "Tabasaran", "Avar", "Andi", "Botlikh", "Godoberi", "Chamalal", "Bagvalal", "Tindi", "Karata", "Akhvakh", "Tsez", "Hinuq", "Bezhta", "Hunzib", "Khwarshi", "Nogai", "Kumyk", "Azerbaijani", "Armenian", "Tat", "Georgian"))
# draw map
map.feature(lang.gltc(vill_meta$glottocode),
latitude = vill_meta$lat,
longitude = vill_meta$lon,
features = vill_meta$lang,
color = vill_meta$lang_color,
label = vill_meta$lang,
zoom.control = T,
popup = vill_meta$village,
tile = c("Esri.WorldTopoMap"))
vill_meta_kutans <- vill_meta %>%
mutate(
kutanlang = case_when(
kutans == FALSE ~ lang,
TRUE ~ "Kutan")) %>%
mutate(
kutancolor = case_when(
kutans == FALSE ~ lang_color,
TRUE ~ "white"))
vill_meta_kutans <- vill_meta %>%
mutate(
kutanlang = case_when(
kutans == FALSE ~ lang,
TRUE ~ "Kutan")) %>%
mutate(
kutancolor = case_when(
kutans == FALSE ~ lang_color,
TRUE ~ "white"))
knitr::opts_chunk$set(echo = TRUE)
# packages
library(tidyverse) # data manipulation
library(lingtypology) # drawing maps
# load data
vill <- read_tsv("data/villages.csv") # dataframe with all villages, coordinates and languages
meta <- read_tsv("data/meta.csv") # dataframe with language metadata and color schemes
# data preparation
vill <- vill[complete.cases(vill$lat),] # remove villages without coordinates
meta_core <- meta %>% # remove idioms not (yet) recognized as distinct
filter(core == "yes")
vill_meta <- merge(vill, meta_core, by = "lang") # merge villages with metadata
# re-order the elements in the legend (by default they are in alphabetical order)
vill_meta$lang <- factor(vill_meta$lang, levels =c(
"Dargwa", "Lak", "Bats", "Ingush", "Chechen", "Khinalug", "Archi", "Tsakhur", "Rutul", "Kryz", "Budukh", "Udi", "Lezgian", "Agul", "Tabasaran", "Avar", "Andi", "Botlikh", "Godoberi", "Chamalal", "Bagvalal", "Tindi", "Karata", "Akhvakh", "Tsez", "Hinuq", "Bezhta", "Hunzib", "Khwarshi", "Nogai", "Kumyk", "Azerbaijani", "Armenian", "Tat", "Georgian"))
# draw map
map.feature(lang.gltc(vill_meta$glottocode),
latitude = vill_meta$lat,
longitude = vill_meta$lon,
features = vill_meta$lang,
color = vill_meta$lang_color,
label = vill_meta$lang,
zoom.control = T,
popup = vill_meta$village,
tile = c("Esri.WorldTopoMap"))
vill_meta$aff <- factor(vill_meta$aff, levels =c("Dargwa", "Lak", "Nakh", "Khinalug", "Lezgic", "Avar", "Andic", "Tsezic", "Kipchak", "Oghuz", "Armenic", "Iranian", "Georgic"))
map.feature(lang.gltc(vill_meta$glottocode),
latitude = vill_meta$lat,
longitude = vill_meta$lon,
features = vill_meta$aff,
width = 8,
label = vill_meta$lang,
color = vill_meta$aff_color,
zoom.control = T,
popup = vill_meta$village,
tile = c("Esri.WorldTopoMap"))
vill_meta_kutans <- vill_meta %>%
mutate(
kutanlang = case_when(
kutans == FALSE ~ lang,
TRUE ~ "Kutan")) %>%
mutate(
kutancolor = case_when(
kutans == FALSE ~ lang_color,
TRUE ~ "white"))
View(vill_meta_kutans)
# re-order the elements in the legend (by default they are in alphabetical order)
vill_meta_kutans$lang <- factor(vill_meta_kutans$lang, levels =c(
"Dargwa", "Lak", "Bats", "Ingush", "Chechen", "Khinalug", "Archi", "Tsakhur", "Rutul", "Kryz", "Budukh", "Udi", "Lezgian", "Agul", "Tabasaran", "Avar", "Andi", "Botlikh", "Godoberi", "Chamalal", "Bagvalal", "Tindi", "Karata", "Akhvakh", "Tsez", "Hinuq", "Bezhta", "Hunzib", "Khwarshi", "Nogai", "Kumyk", "Azerbaijani", "Armenian", "Tat", "Georgian", "Kutan"))
# draw map
map.feature(lang.gltc(vill_meta_kutans$glottocode),
latitude = vill_meta_kutans$lat,
longitude = vill_meta_kutans$lon,
features = vill_meta_kutans$kutanlang,
color = vill_meta_kutans$kutancolor,
label = vill_meta_kutans$lang,
zoom.control = T,
popup = vill_meta_kutans$village,
tile = c("Esri.WorldTopoMap"))
vill_meta_kutans <- vill_meta %>%
mutate(
kutanlang = case_when(
kutans == FALSE ~ lang,
TRUE ~ "Kutan")) %>%
mutate(
kutancolor = case_when(
kutans == FALSE ~ lang_color,
TRUE ~ "white"))