From 41e1b15029c392162d49b6123255966b68b3c0c2 Mon Sep 17 00:00:00 2001 From: Thomas Klebel Date: Wed, 7 Jul 2021 10:57:14 +0200 Subject: [PATCH] prepare to and merge countries --- data/processed/countries_merged.csv | 173 ++++++++++++++++++++++++++ data/processed/countries_to_merge.csv | 173 ++++++++++++++++++++++++++ scripts/03-merge-countries.R | 21 ++++ 3 files changed, 367 insertions(+) create mode 100644 data/processed/countries_merged.csv create mode 100644 data/processed/countries_to_merge.csv create mode 100644 scripts/03-merge-countries.R diff --git a/data/processed/countries_merged.csv b/data/processed/countries_merged.csv new file mode 100644 index 0000000..0b7f694 --- /dev/null +++ b/data/processed/countries_merged.csv @@ -0,0 +1,173 @@ +E1,E1_rec +Argentina,Argentina +Australia,Australia +Australia,Australia +Australia,Australia +Australia (and throughout South and SE Asia),Australia +Austria,Austria +Austria,Austria +Austria,Austria +Austria and interantionally,Austria +Belgium,Belgium +Brasil,Brazil +Brasil,Brazil +Brazil,Brazil +Brazil,Brazil +Brazil,Brazil +Brazil,Brazil +Brazil,Brazil +Brazil.,Brazil +Canada,Canada +Canada,Canada +Catalonia,Spain +Chile,Chile +Chile,Chile +Denmark,Denmark +Denmark,Denmark +Denmark,Denmark +Deutschland,Germany +England,United Kingdom +España,Spain +Estonia,Estonia +Finland,Finland +Finland,Finland +Finland,Finland +France,France +France,France +Germany,Germany +Germany,Germany +Germany,Germany +Germany,Germany +germany,Germany +India,India +Iran,Iran +Ireland,Ireland +Italia,Italy +Italy,Italy +italy,Italy +Italy,Italy +Italy,Italy +Italy,Italy +Italy,Italy +K, +Malaysia,Malaysia +NA, +NA, +NA, +NA, +NA, +Netherlands,Netherlands +Netherlands,Netherlands +New Zealand,New Zealand +Nigeria,Nigeria +norway,Norway +Norway,Norway +Norway,Norway +Norway,Norway +Palestine,Palestine +Poland,Poland +Polska,Poland +Portugal,Portugal +Portugal,Portugal +Portugal,Portugal +Portugal,Portugal +Portugal,Portugal +Portugal,Portugal +Portugal,Portugal +Portugal,Portugal +Portugal,Portugal +portugal,Portugal +Portugal,Portugal +Portugal,Portugal +Portugal,Portugal +Portugal,Portugal +Portugal,Portugal +Portugal,Portugal +Qatar,Qatar +Romania,Romania +Romania,Romania +Romania,Romania +Russian Federation,Russia +Serbia,Serbia +Serbia,Serbia +Slovenia,Slovenia +Slovenia,Slovenia +South Africa,South Africa +Spain,Spain +Spain,Spain +Spain,Spain +Spain,Spain +Spain,Spain +Spain,Spain +Spain,Spain +Spain,Spain +Spain,Spain +Spain,Spain +Spain,Spain +Spain,Spain +Spain,Spain +SPAIN,Spain +Spain,Spain +Spain,Spain +spain,Spain +Switzerland,Switzerland +switzerland,Switzerland +The Netherlands,Netherlands +Turkey/Turkiye,Turkey +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +uk,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +United States,United States +United States,United States +USA,United States +USA,United States +USA,United States +xx, \ No newline at end of file diff --git a/data/processed/countries_to_merge.csv b/data/processed/countries_to_merge.csv new file mode 100644 index 0000000..447e4ce --- /dev/null +++ b/data/processed/countries_to_merge.csv @@ -0,0 +1,173 @@ +E1,E1_rec +UK,United Kingdom +UK,United Kingdom +Switzerland,Switzerland +Italy,Italy +UK,United Kingdom +UK,United Kingdom +UK,United Kingdom +Austria,Austria +United Kingdom,United Kingdom +Germany,Germany +Portugal,Portugal +UK,United Kingdom +United Kingdom,United Kingdom +United Kingdom,United Kingdom +UK,United Kingdom +Germany,Germany +norway,Norway +Portugal,Portugal +Romania, +Romania, +United Kingdom,United Kingdom +United Kingdom,United Kingdom +Germany,Germany +United Kingdom,United Kingdom +United Kingdom,United Kingdom +Spain,Spain +Finland, +Netherlands, +United Kingdom,United Kingdom +Iran, +xx, +UK,United Kingdom +Italia, +Portugal,Portugal +Chile, +Slovenia, +italy,Italy +Spain,Spain +Turkey/Turkiye, +Catalonia, +Spain,Spain +Brazil, +NA, +Spain,Spain +Spain,Spain +Canada, +Malaysia, +Spain,Spain +Spain,Spain +switzerland,Switzerland +France, +Argentina, +Spain,Spain +Denmark,Denmark +Spain,Spain +Spain,Spain +Spain,Spain +Spain,Spain +Denmark,Denmark +Australia (and throughout South and SE Asia), +España, +Norway,Norway +UK,United Kingdom +Portugal,Portugal +Italy,Italy +UK,United Kingdom +Spain,Spain +SPAIN,Spain +United Kingdom,United Kingdom +Italy,Italy +Deutschland, +United Kingdom,United Kingdom +Belgium, +Denmark,Denmark +Brazil, +Portugal,Portugal +USA, +Brazil, +Qatar, +Spain,Spain +Spain,Spain +United Kingdom,United Kingdom +Palestine, +Serbia, +United States,United States +United Kingdom,United Kingdom +Poland, +Brasil, +Portugal,Portugal +Italy,Italy +UK,United Kingdom +UK,United Kingdom +England, +K, +Portugal,Portugal +United Kingdom,United Kingdom +United Kingdom,United Kingdom +Portugal,Portugal +Brasil, +Germany,Germany +France, +USA, +UK,United Kingdom +Finland, +UK,United Kingdom +Norway,Norway +United Kingdom,United Kingdom +Austria and interantionally, +UK,United Kingdom +Italy,Italy +UK,United Kingdom +United Kingdom,United Kingdom +UK,United Kingdom +Portugal,Portugal +NA, +United Kingdom,United Kingdom +UK,United Kingdom +UK,United Kingdom +United Kingdom,United Kingdom +Brazil., +South Africa, +United Kingdom,United Kingdom +United Kingdom,United Kingdom +Chile, +United Kingdom,United Kingdom +portugal,Portugal +United Kingdom,United Kingdom +New Zealand, +Austria,Austria +Romania, +UK,United Kingdom +Canada, +uk,United Kingdom +USA, +Slovenia, +Netherlands, +Nigeria, +Russian Federation, +United Kingdom,United Kingdom +NA, +UK,United Kingdom +United Kingdom,United Kingdom +The Netherlands, +Australia, +Finland, +India, +spain,Spain +UK,United Kingdom +NA, +Portugal,Portugal +United Kingdom,United Kingdom +Ireland, +Portugal,Portugal +Portugal,Portugal +UK,United Kingdom +Portugal,Portugal +Brazil, +Portugal,Portugal +Polska, +Australia, +Brazil, +United States,United States +Austria,Austria +Serbia, +Estonia, +United Kingdom,United Kingdom +Portugal,Portugal +UK,United Kingdom +Australia, +germany,Germany +NA, +Norway,Norway diff --git a/scripts/03-merge-countries.R b/scripts/03-merge-countries.R new file mode 100644 index 0000000..86903c3 --- /dev/null +++ b/scripts/03-merge-countries.R @@ -0,0 +1,21 @@ +library(tidyverse) + +df <- read_csv("data/processed/survey_anonymised.csv") + +countries <- df %>% + select(E1) %>% + mutate(E1_rec = case_when(str_to_lower(E1) == "uk" ~ "United Kingdom", + E1 == "United Kingdom" ~ E1, + str_to_lower(E1) == "italy" ~ "Italy", + str_to_lower(E1) == "spain" ~ "Spain", + str_to_lower(E1) == "portugal" ~ "Portugal", + str_to_lower(E1) == "switzerland" ~ "Switzerland", + str_to_lower(E1) == "austria" ~ "Austria", + str_to_lower(E1) == "norway" ~ "Norway", + str_to_lower(E1) == "denmark" ~ "Denmark", + str_to_lower(E1) == "united states" ~ "United States", + str_to_lower(E1) == "germany" ~ "Germany", + TRUE ~ "")) + +countries %>% + write_csv("data/processed/countries_to_merge.csv")