-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget_journals.R
46 lines (40 loc) · 1.77 KB
/
get_journals.R
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
get_journals <- function(data, reference_df) {
# Getting journal names
abbrTable <-
read_csv("https://docs.google.com/spreadsheets/d/1vCyke7hw-iaReOkQkuxMiWBLQxtQLbTxIMFHj7P3gJ0/export?format=csv&gid=74429560")
journals_all_abbr <- # From Scimago data
abbrTable |>
dplyr::select(journal, journal_abbr) |>
dplyr::mutate(journal_abbr = str_remove_all(journal_abbr, "\\.")) |>
dplyr::mutate(journal_abbr = str_to_upper(journal_abbr)) |>
dplyr::mutate(journal = str_remove_all(journal, "\\.")) |>
dplyr::mutate(journal = str_to_upper(journal)) |>
dplyr::select(journal, journal_abbr) |>
unique() |>
dplyr::filter(!duplicated(journal_abbr)) |>
tidyr::drop_na() |>
dplyr::mutate(journal = str_replace(string = journal,
pattern = " & ",
replacement = " AND "))
df_1_journal <-
data |>
dplyr::select(SR,
JI_main = JI,
PY_main = PY) |>
dplyr::right_join(reference_df |>
dplyr::select(SR,
JI_ref = JI,
PY_ref = PY)) |>
dplyr::mutate(JI_main = str_remove_all(JI_main, "\\.")) |>
# dplyr::inner_join(journals_all_abbr,
# by = c("JI_ref" = "journal_abbr")) |>
dplyr::left_join(journals_all_abbr,
by = c("JI_ref" = "journal")) |>
dplyr::mutate(JI_ref = if_else(!(is.na(journal_abbr)),
journal_abbr,
JI_ref )) |>
dplyr::select(-journal_abbr)
# dplyr::filter(!(JI_ref == "")) |>
# dplyr::filter(!(JI_main == JI_ref))
return(journal_df = df_1_journal)
}