Skip to content

Commit

Permalink
fix Janda country issues (DDR, MWI)
Browse files Browse the repository at this point in the history
  • Loading branch information
hdigital committed Nov 11, 2018
1 parent d796e78 commit 1516dc5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions import/janda/janda-country.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ id,country,short
3,New Zealand,NZL
4,Canada,CAN
5,Ireland,IRL
7,Rhodesia and Nyasaland,
7,Rhodesia and Nyasaland,MWI
8,India,IND
10,Austria,AUT
11,France,FRA
Expand Down Expand Up @@ -34,7 +34,7 @@ id,country,short
58,Malaya (now Malaysia),MYS
60,Albania,ALB
61,Bulgaria,BGR
63,East Germany,GDR
63,East Germany,DDR
64,Hungary,HUN
67,U. S. S. R.,RUS
74,Sudan,SDN
Expand Down
12 changes: 5 additions & 7 deletions import/janda/janda.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ country <- read_csv("janda-country.csv")

# extract country id from party id
janda <- janda %>%
mutate(country_id = substr(janda_id, 1, nchar(janda_id) - 1) %>% as.integer,
country_id = ifelse(janda_id >= 10, country_id, 0)) # add US country id "0"
mutate(
country_id = substr(janda_id, 1, nchar(janda_id) - 1) %>% as.integer,
country_id = ifelse(janda_id >= 10, country_id, 0) # add US country id "0"
)

# merge parties and country list
janda <- janda %>%
left_join(country, by = c("country_id" = "id")) %>%
select(-country_id, country_short = short) %>%
filter(country_short != "")

# correct iso3 country names
janda[janda$country_short == "GDR", "country_short"] <- "DDR"
select(-country_id, country_short = short)

write_csv(janda, "janda.csv", na = "")
4 changes: 4 additions & 0 deletions import/janda/janda.csv
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ janda_id,name,country,country_short
51,Irish Fianna Fail,Ireland,IRL
52,Irish Fine Gael,Ireland,IRL
53,Irish Labour Party,Ireland,IRL
71,Rhodesian & Nyasaland United Federal Party,Rhodesia and Nyasaland,MWI
72,Rhodesian & Nyasaland Confederate/Dominion Party,Rhodesia and Nyasaland,MWI
73,Northern Rhodesian African National Congress,Rhodesia and Nyasaland,MWI
74,Malawi (Nyasaland) Congress Party,Rhodesia and Nyasaland,MWI
81,Indian National Congress,India,IND
82,Indian Communist Party,India,IND
101,Austrian People's Party,Austria,AUT
Expand Down

0 comments on commit 1516dc5

Please sign in to comment.