Skip to content

Commit 604160c

Browse files
committed
feat: use lowercase variable names as in other csv files
1 parent 8ee06de commit 604160c

File tree

4 files changed

+47
-39
lines changed

4 files changed

+47
-39
lines changed

assets/background_data/political_parties.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Party;Full Name;Party Family;Colour;Origin;Left-Right;State-Market;Liberty-Authority;Anti-Pro EU
1+
party;full_name;party_family;colour;origin;left_right;state_market;liberty_authority;anti_pro_eu
22
IA;Inuit Ataqatigiit;Communist/Socialist;#AB2328;GL;1.3;1.4;3;3.3
33
N;Naleraq;;#FF6900;GL;;;;
44
NQ;Nunatta Qitornai;;#A1359B;GL;;;;

assets/background_data/political_parties.csv-metadata.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"url": "political_parties.csv",
44
"dc:title": "Political Parties",
55
"dc:publisher": "Moritz Twente",
6-
"dc:updated": "2025-08-21",
6+
"dc:updated": "2025-08-27",
77
"dc:type": "Dataset",
88
"dc:format": "text/csv",
99
"dc:license": "https://creativecommons.org/licenses/by/4.0/",
@@ -12,57 +12,57 @@
1212
"notes": "Table with names and policy positions of Northatlantic political parties that have been represented in Folketinget.",
1313
"columns": [
1414
{
15-
"name": "Party",
15+
"name": "party",
1616
"dc:title": "Political Party",
1717
"description": "Abbreviation for the political party",
1818
"datatype": "string"
1919
},
2020
{
21-
"name": "Full Name",
21+
"name": "full_name",
2222
"dc:title": "Full Name",
2323
"description": "Full name of the political party",
2424
"datatype": "string",
2525
"lang": "kl|fo"
2626
},
2727
{
28-
"name": "Party Family",
28+
"name": "party_family",
2929
"dc:title": "Party Family",
3030
"description": "Title of the political party family the party is part of",
3131
"datatype": "string",
3232
"lang": "en"
3333
},
3434
{
35-
"name": "Colour",
35+
"name": "colour",
3636
"dc:title": "Party Colour",
3737
"description": "HEX Code of the main colour of the policial party, taken from Wikipedia",
3838
"datatype": "string"
3939
},
4040
{
41-
"name": "Origin",
41+
"name": "origin",
4242
"dc:title": "Origin",
4343
"description": "Geographical origin of the political party",
4444
"datatype": { "base": "string", "format": "GL|FO" }
4545
},
4646
{
47-
"name": "Left-Right",
47+
"name": "left_right",
4848
"dc:title": "Left-Right Position",
4949
"description": "Placement on the Left-Right scale",
5050
"datatype": { "base": "integer", "minimum": "0", "maximum": "10" }
5151
},
5252
{
53-
"name": "State-Market",
53+
"name": "state_market",
5454
"dc:title": "State-Market Position",
5555
"description": "Placement on the State-Market scale",
5656
"datatype": { "base": "integer", "minimum": "0", "maximum": "10" }
5757
},
5858
{
59-
"name": "Liberty-Authority",
59+
"name": "liberty_authority",
6060
"dc:title": "Liberty-Authority Position",
6161
"description": "Placement on the Liberty-Authority scale",
6262
"datatype": { "base": "integer", "minimum": "0", "maximum": "10" }
6363
},
6464
{
65-
"name": "Anti-Pro EU",
65+
"name": "anti_pro_eu",
6666
"dc:title": "Anti-Pro EU Position",
6767
"description": "Placement on the Anti-Pro EU scale",
6868
"datatype": { "base": "integer", "minimum": "0", "maximum": "10" }
@@ -73,34 +73,34 @@
7373
"quoteChar": "\"",
7474
"encoding": "UTF-8"
7575
},
76-
"primaryKey": ["Party"],
76+
"primaryKey": ["party"],
7777
"foreignKeys": [
7878
{
79-
"columnReference": "Left-Right",
79+
"columnReference": "left_right",
8080
"reference": {
8181
"resource": "Döring, Holger; Huber, Constantin; Manow, Philip, 2022, 'ParlGov 2022 Release', https://doi.org/10.7910/DVN/UKILBE, Harvard Dataverse, V1; parlgov-stable.xlsx [fileName]",
8282
"columnReference": "left_right",
8383
"dc:description": "0--10 scale mean value in left/right dimension with data from Castles/Mair 1983, Huber/Inglehart 1995, Benoit/Laver 2006 and CHES 2010"
8484
}
8585
},
8686
{
87-
"columnReference": "State-Market",
87+
"columnReference": "state_market",
8888
"reference": {
8989
"resource": "Döring, Holger; Huber, Constantin; Manow, Philip, 2022, 'ParlGov 2022 Release', https://doi.org/10.7910/DVN/UKILBE, Harvard Dataverse, V1; parlgov-stable.xlsx [fileName]",
9090
"columnReference": "state_market",
9191
"dc:description": "0--10 scale mean value in 'regulation of the economy' dimension with data from Benoit/Laver 2006 and CHES 2010"
9292
}
9393
},
9494
{
95-
"columnReference": "Liberty-Authority",
95+
"columnReference": "liberty_authority",
9696
"reference": {
9797
"resource": "Döring, Holger; Huber, Constantin; Manow, Philip, 2022, 'ParlGov 2022 Release', https://doi.org/10.7910/DVN/UKILBE, Harvard Dataverse, V1; parlgov-stable.xlsx [fileName]",
9898
"columnReference": "liberty_authority",
9999
"dc:description": "0--10 scale mean value in 'libertarian/authoritarian' dimension with data from Benoit/Laver 2006 and CHES 2010"
100100
}
101101
},
102102
{
103-
"columnReference": "Anti-Pro EU",
103+
"columnReference": "anti_pro_eu",
104104
"reference": {
105105
"resource": "Döring, Holger; Huber, Constantin; Manow, Philip, 2022, 'ParlGov 2022 Release', https://doi.org/10.7910/DVN/UKILBE, Harvard Dataverse, V1; parlgov-stable.xlsx [fileName]",
106106
"columnReference": "eu_anti_pro",

docs/codebook.qmd

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,15 @@ classDiagram
215215
}
216216
217217
class political_parties {
218-
Party : string
219-
Full Name : string
220-
Party Family : string
221-
Colour : string
222-
Origin : string
223-
Left-Right : float
224-
State-Market : float
225-
Liberty-Authority : float
226-
Anti-Pro EU : float
218+
party : string
219+
full_name : string
220+
party_family : string
221+
colour : string
222+
origin : string
223+
left_right : float
224+
state_market : float
225+
liberty_authority : float
226+
anti_pro_eu : float
227227
}
228228
229229
style ballot_info_raw fill:#D1BBD7
@@ -311,7 +311,7 @@ summary(mp_names$party)
311311

312312
All represented political parties are listed in @tbl-parties with additional information (where available) on their positions from the ParlGov dataset [@doringParlGov2022Release2022].
313313

314-
Since 2004, MPs from the Faroe Islands were members of `r sum(political_parties$Origin == "FO")` different political parties. Voters in Greenland elected politicians from `r sum(political_parties$Origin == "GL") - 2` different political parties. However, two of the Greenlandic representatives -- Aleqa Hammond and Aki-Matilda Høegh-Dam -- switched party affiliation during their time as member of Folketinget and became members of newly formed parties (Nunatta Qitornai and Naleraq[^2]).
314+
Since 2004, MPs from the Faroe Islands were members of `r sum(political_parties$origin == "FO")` different political parties. Voters in Greenland elected politicians from `r sum(political_parties$origin == "GL") - 2` different political parties. However, two of the Greenlandic representatives -- Aleqa Hammond and Aki-Matilda Høegh-Dam -- switched party affiliation during their time as member of Folketinget and became members of newly formed parties (Nunatta Qitornai and Naleraq[^2]).
315315

316316
[^2]: Both parties have been formed quite recently. See @ahlnessNunattaQitornaiParty2020 for general information on Nunatta Qitornai and their policies.
317317

@@ -321,14 +321,18 @@ Since 2004, MPs from the Faroe Islands were members of `r sum(political_parties$
321321
#| label: tbl-parties
322322
#| tbl-cap: List of political parties from Greenland and the Faroe Islands with a MP in Folketinget since 2004.
323323
324-
parties_gl <- subset(political_parties, Origin == "GL")[, !(names(political_parties) %in% c("Origin", "Colour"))]
325-
parties_fo <- subset(political_parties, Origin == "FO")[, !(names(political_parties) %in% c("Origin", "Colour"))]
324+
parties_gl <- subset(political_parties, origin == "GL")[, !(names(political_parties) %in% c("origin", "colour"))]
325+
parties_fo <- subset(political_parties, origin == "FO")[, !(names(political_parties) %in% c("origin", "colour"))]
326326
327327
rownames(parties_gl) <- NULL
328328
rownames(parties_fo) <- NULL
329329
330-
kable(parties_gl, caption = "Greenlandic Parties")
331-
kable(parties_fo, caption = "Faroese Parties")
330+
printable_names <- c("Party", "Full Name", "Party Family", "Left–Right", "State–Market", "Liberty–Authority", "Anti–Pro-EU")
331+
332+
kable(parties_gl, caption = "Greenlandic Parties",
333+
col.names = printable_names)
334+
kable(parties_fo, caption = "Faroese Parties",
335+
col.names = printable_names)
332336
```
333337

334338
#### MP_names\$substitute

report.qmd

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ ggplot(mandates, aes(x = start, xend = end, y = surname, yend = surname, color =
173173

174174
## Political Parties
175175

176-
Since 2004, MPs from the Faroe Islands were members of `r sum(political_parties$Origin == "FO")` different political parties. Voters in Greenland elected politicians from `r sum(political_parties$Origin == "GL") - 2` different political parties. However, two of the Greenlandic representatives -- Aleqa Hammond and Aki-Matilda Høegh-Dam -- switched party affiliation during their time as member of Folketinget and joined two relatively young parties (Nunatta Qitornai and Naleraq[^3]).
176+
Since 2004, MPs from the Faroe Islands were members of `r sum(political_parties$origin == "FO")` different political parties. Voters in Greenland elected politicians from `r sum(political_parties$origin == "GL") - 2` different political parties. However, two of the Greenlandic representatives -- Aleqa Hammond and Aki-Matilda Høegh-Dam -- switched party affiliation during their time as member of Folketinget and joined two relatively young parties (Nunatta Qitornai and Naleraq[^3]).
177177

178178
[^3]: Both parties have been formed quite recently -- Naleraq in 2014 and Nunatta Qitornai in 2017. See @ahlnessNunattaQitornaiParty2020 for general information on Nunatta Qitornai and their policies.
179179

@@ -187,14 +187,18 @@ All represented political parties are listed in @tbl-parties with additional inf
187187
#| label: tbl-parties
188188
#| tbl-cap: List of political parties from Greenland and the Faroe Islands with an MP in Folketinget since 2004.
189189
190-
parties_gl <- subset(political_parties, Origin == "GL")[, !(names(political_parties) %in% c("Origin", "Colour"))]
191-
parties_fo <- subset(political_parties, Origin == "FO")[, !(names(political_parties) %in% c("Origin", "Colour"))]
190+
parties_gl <- subset(political_parties, origin == "GL")[, !(names(political_parties) %in% c("origin", "colour"))]
191+
parties_fo <- subset(political_parties, origin == "FO")[, !(names(political_parties) %in% c("origin", "colour"))]
192192
193193
rownames(parties_gl) <- NULL
194194
rownames(parties_fo) <- NULL
195195
196-
kable(parties_gl, caption = "Greenlandic Parties")
197-
kable(parties_fo, caption = "Faroese Parties")
196+
printable_names <- c("Party", "Full Name", "Party Family", "Left–Right", "State–Market", "Liberty–Authority", "Anti–Pro-EU")
197+
198+
kable(parties_gl, caption = "Greenlandic Parties",
199+
col.names = printable_names)
200+
kable(parties_fo, caption = "Faroese Parties",
201+
col.names = printable_names)
198202
```
199203

200204
```{r party-timeline}
@@ -211,7 +215,7 @@ party_periods <- mandates %>%
211215
212216
# join colours from political_parties
213217
party_periods <- party_periods %>%
214-
left_join(political_parties %>% select("Party", "Full Name", "Colour"), by = c("party" = "Party"))
218+
left_join(political_parties %>% select("party", "full_name", "colour"), by = "party")
215219
216220
# sort parties with start date
217221
party_periods <- party_periods %>%
@@ -220,13 +224,13 @@ party_periods <- party_periods %>%
220224
ungroup()
221225
222226
# set party name labels including UF
223-
y_labels <- setNames(party_periods$`Full Name`, party_periods$party)
227+
y_labels <- setNames(party_periods$full_name, party_periods$party)
224228
y_labels <- c(y_labels, "UF" = "No Party Affiliation")
225229
226230
# set UF colour to grey
227-
party_periods$Colour[party_periods$party == "UF"] <- "#777777"
231+
party_periods$colour[party_periods$party == "UF"] <- "#777777"
228232
229-
ggplot(party_periods, aes(x = start, xend = end, y = party, yend = party, color = Colour)) +
233+
ggplot(party_periods, aes(x = start, xend = end, y = party, yend = party, color = colour)) +
230234
geom_segment(linewidth = 8, lineend = "butt") +
231235
scale_color_identity() +
232236

0 commit comments

Comments
 (0)