rscopus_plus: An extension of the rscopus package

[This article was first published on R on Pablo Bernabeu, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Sometimes it’s useful to do a bibliometric analysis. To this end, the rscopus_plus functions (Bernabeu, 2024) extend the R package rscopus (Muschelli, 2022) to administer the search quota and to enable specific searches and comparisons.

Example of use

As an example (also available on GitHub), we’ll visualise the prevalence of three executive functions in the literatures on second and third language throughout the past two decades.

First, we’ll use the scopus_comparison function (fragment shown below).

library(rscopus)
# set_api_key('your_key_here')  # (see https://cran.r-project.org/web/packages/rscopus/vignettes/api_key.html)

# I'll read in mine from a file. If you do this, make sure not to share your file.
api_key = readLines('scopus_key.txt')
set_api_key(api_key)

library(dplyr)
library(patchwork)


# Load in Scopus search functions from https://github.com/pablobernabeu/rscopus_plus
source('https://raw.githubusercontent.com/pablobernabeu/rscopus_plus/main/scopus_comparison.R')
source('https://raw.githubusercontent.com/pablobernabeu/rscopus_plus/main/plot_scopus_comparison.R')


# General parameters
search_period = 2000:2023
quota = 20


# Prevalence of three executive functions in second language studies from 2000 to 2023. 

# In addition to "second language", the reference query includes the terms 
# "learning" and "cognition" to make the scope of the search more relevant to 
# the topic of interest. 

reference_query = '"second language"'

comparison_terms = c( '"working memory"', 'inhibition', '"implicit learning"' )

N_comparison_terms = length(comparison_terms)

L2_EF = 
  scopus_comparison(reference_query, comparison_terms, 
                    search_period, quota, verbose = FALSE, 
                    reference_query_field_tag = 'TITLE-ABS-KEY')

saveRDS(L2_EF, 'L2_EF.rds')

L2_EF = readRDS('L2_EF.rds')  # it's possible to load results directly

plot_L2_EF = 
  plot_scopus_comparison(L2_EF, 
                         pub_count_in_legend = FALSE, 
                         pub_count_in_lines = TRUE) +
  scale_color_manual(
    values = c( "[ref.] + '\"working memory\"'" = scales::hue_pal()(N_comparison_terms)[1],
                "[ref.] + 'inhibition'" = scales::hue_pal()(N_comparison_terms)[2], 
                "[ref.] + '\"implicit learning\"'" = scales::hue_pal()(N_comparison_terms)[3] )
  ) + 
  guides(colour = guide_legend(override.aes = list(alpha = 1))) +
  # Prepare layout for the multi-plot combination
  theme(axis.text.x = element_blank(), axis.title.x = element_blank(), 
        legend.position = 'none', plot.margin = margin(0, 0, 15, 0))


# Prevalence of three executive functions in third language studies from 2000 to 2023. 

# In addition to "third language", the reference query includes the terms "learning" 
# and "cognition" to make the scope of the search more relevant to the topic of 
# interest. 

reference_query = '"third language"'

L3_EF = 
  scopus_comparison(reference_query, comparison_terms, 
                    search_period, quota, verbose = FALSE, 
                    reference_query_field_tag = 'TITLE-ABS-KEY')

saveRDS(L3_EF, 'L3_EF.rds')

L3_EF = readRDS('L3_EF.rds')  # it's possible to load results directly

plot_L3_EF = 
  plot_scopus_comparison(L3_EF, 
                         pub_count_in_legend = FALSE, 
                         pub_count_in_lines = TRUE) +
  scale_color_manual(
    values = c( "[ref.] + '\"working memory\"'" = scales::hue_pal()(N_comparison_terms)[1],
                "[ref.] + 'inhibition'" = scales::hue_pal()(N_comparison_terms)[2], 
                "[ref.] + '\"implicit learning\"'" = scales::hue_pal()(N_comparison_terms)[3] )
  ) + 
  guides(colour = guide_legend(override.aes = list(alpha = 1))) +
  # Prepare layout for the multi-plot combination
  theme(axis.text.x = element_text(margin = margin(7, 0, 0, 0, 'pt')),
        axis.title.x = element_text(margin = margin(8, 0, 0, 0, 'pt')),
        legend.justification = 'right', plot.margin = margin(0, 0, 0, 0))


# Combine plots

plot_L2_EF + plot_L3_EF + 
  plot_layout(ncol = 1, axes = 'collect') &
  theme(axis.text = element_text(size = 10),
        axis.title = element_text(vjust = 0.5, size = 13), 
        plot.title = element_markdown(hjust = 0.5, size = 12),
        legend.text = element_text(size = 12),
        legend.background = element_rect(color = 'grey70'), 
        legend.margin = margin(-5, 5, 2, 0)) 

The total number of publications over the current period is shown between brackets after each query.

References

Bernabeu, P. (2024). rscopus_plus (v1.1.5). Zenodo. https://doi.org/10.5281/zenodo.10689747

Muschelli, J. (2022). Package ’rscopus’. CRAN. https://cran.r-project.org/web/packages/rscopus/rscopus.pdf

To leave a comment for the author, please follow the link and comment on their blog: R on Pablo Bernabeu.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)