Skip to contents

This function is a simple wrapper to unify journal ids.

Usage

jst_unify_journal_id(meta_data, remove_cols = TRUE)

Arguments

meta_data

Data which was processed via jst_get_article().

remove_cols

Should the original columns be removed after unifying?

Value

A modified tibble.

A modified tibble.

Details

Date on journal ids can be found in three columns: journal_pub_id, journal_jcode and journal_doi. From my experience, most of the time the relevant dat ais present in journal_pub_id or journal_jcode, with journal_jcode being to most common identifier. This function takes the value from journal_pub_id, and if it is missing, that from journal_jcode. journal_doi is currently disregarded.

Examples

article <- jst_get_article(jst_example("article_with_references.xml"))

jst_unify_journal_id(article)
#> # A tibble: 1 × 17
#>   file_name  journal_title article_doi article_pub_id article_jcode article_type
#>   <chr>      <chr>         <chr>       <chr>          <chr>         <chr>       
#> 1 article_w… Transactions… 10.2307/32… NA             NA            research-ar…
#> # ℹ 11 more variables: article_title <chr>, volume <chr>, issue <chr>,
#> #   language <chr>, pub_day <chr>, pub_month <chr>, pub_year <int>,
#> #   first_page <chr>, last_page <chr>, page_range <chr>, journal_id <chr>


# per default, original columns with data on the journal are removed
library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union

jst_unify_journal_id(article) %>% 
  select(contains("journal")) %>% 
  names()
#> [1] "journal_title" "journal_id"   
  
# you can keep them by setting `remove_cols` to `FALSE`
jst_unify_journal_id(article, remove_cols = FALSE) %>%  
  select(contains("journal")) %>%
  names()
#> [1] "journal_doi"    "journal_jcode"  "journal_pub_id" "journal_title" 
#> [5] "journal_id"