Skip to content

Instantly share code, notes, and snippets.

@njahn82
Created August 12, 2020 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save njahn82/b1e7d48e472f8f1dca7faa13897a0a11 to your computer and use it in GitHub Desktop.
Save njahn82/b1e7d48e472f8f1dca7faa13897a0a11 to your computer and use it in GitHub Desktop.
C1 WOS
library(tidyverse)
my_df <- readr::read_csv("data/u4_13_17.csv")
no_group <- my_df %>%
filter(is.na(CA))
no_group %>%
select(PY, UT, C1) %>%
mutate(adresses = strsplit(C1, "; \\[")) -> tt
tt %>%
unnest() %>%
tidyr::separate(adresses, sep ="] ", c("authors", "address"), fill = "left") %>%
mutate(authors = gsub("\\[", "", authors)) %>%
mutate(institution = gsub(",.*$", "", address)) %>%
select(PY, UT, authors, institution) -> au_df
au_df %>%
mutate(u4 = ifelse(grepl("Goettingen|Gottingen", institution, ignore.case = TRUE, fixed = FALSE), "Uni Göttingen", NA)) %>%
mutate(u4 = ifelse(grepl("Ghent|Univ Hosp Gent", institution, ignore.case = TRUE, fixed = FALSE), "Uni Ghent", u4)) %>%
mutate(u4 = ifelse(grepl("Uppsala", institution, ignore.case = TRUE, fixed = FALSE), "Uni Uppsala", u4)) %>%
mutate(u4 = ifelse(grepl("Groningen", institution, ignore.case = TRUE, fixed = FALSE), "Uni Groningen", u4)) %>%
mutate(u4 = ifelse(grepl("Tartu", institution, ignore.case = TRUE, fixed = FALSE), "Uni Tartu", u4)) %>%
filter(!is.na(u4)) -> u4_df
write_csv(u4_df, "data/u4_df.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment