Intro

Hello everyone. I’m looking forward to our session at FSCI 2020 on “W24 - Working with Scholarly Literature in R: Pulling, Wrangling, Cleaning, and Analyzing Structured Bibliographic Metadata.”

This entire course is distributed under a Creative Commons Attribution 4.0 International (CC BY 4.0) License.

The OSF home is at https://osf.io/hd4re/. Here you can find each day’s components laid out clearly, as well as links to the live Zoom sessions. While FSCI is in session, this link is only available to people enrolled in the class. The FSCI course Slack can be found at https://fsci2020.slack.com/–participants will already be added to the w24_working_with_scholarly_literature_in_r channel.

Click the button below to launch the Binder for the entire repository: Binder

https://mybinder.org/v2/gh/ciakovx/ciakovx.github.io/master

To view the course structure and exercises, see below Course Schedule:

Course Information

Title: Working with Scholarly Literature in R: Pulling, Wrangling, Cleaning, and Analyzing Structured Bibliographic Metadata

Instructor: Clarke Iakovakis, Scholarly Services Librarian, Oklahoma State University, https://info.library.okstate.edu/clarke-iakovakis

Course Website: https://ciakovx.github.io/fsci_syllabus.html

Acknowledgments: Acknowledgements for this course go to the organizations and developers who have created the APIs we have used and made them open–namely Crossref, Orcid, and Unpaywall; those who have created the software, packages and tools we are using–namely the R Core Team, the RStudio Team, Hadley Wickham, Karthik Ram, Najko Jahn, Scott Chamberlain, rOpenSci, Yihui Xie, Garrett Grolemund, Linus Torvalds, Scott Chacon, Ben Straub, Git, GitHub, The Binder Project, Project Jupyter, and see also the package citations; and finally those who have created enormously helpful resources for learning and teaching R–namely Roger Peng, Jeff Leek, Coursera, the Carpentries, Lisa Federer, Paul Oldham, Brad Boehmke, Edwin de Jonge and Mark van der Loo. I have benefitted from many, many more have dedicated their time, labor, and effort that I have overlooked. It is only due to the generosity and dedication of these people and organizations I am able to put this class together.

Description:

Developers have created a number of packages for accessing the scholarly literature in R over the last several years, among them rcrossref, rorcid, and roadoi. These packages make use of the APIs in their systems to allow users to execute specific queries and pull the structured data into R, where it can be reshaped, merged with other data, and analyzed. This session will be based on the workshop I provided at last year’s FSCI. The course will assume no experience with R; however, a thorough explanation of the R programming language will not be provided.

The course will a mixture of pre-recorded videos and synchronous meeting for discussion and Q&A sessions.

Students will access IPNYB (Jupyter Notebooks) files containing the scripts for the workshop, created with binder. The files will include executable code alongside descriptions of what the code is doing. Students can therefore run code that has already been written, but will also write and execute their own R scripts within the Jupyter Notebooks environment. Students will access these notebooks while watching the videos explaining the code.

We will begin with a general orientation of the Jupyter Notebooks environment. We will then discuss R and provide a basic overview of how it works. This introduction will include reading data into R, installing packages, and some functions for cleaning and restructuring data. We will then discuss Crossref, ORCID, and Unpaywall, and the packages developed by the rOpenSci organization to access the API services of these organizations, and walk through rcrossref, roadoi, and rorcid.

  • rcrossref interfaces with the CrossRef API, allowing users to pull article metadata based on ISSN, filter queries by publication date and license information, running queries by title and author, getting funder data, getting citation counts, and exporting to BibTeX, RIS, and CSV. This can be immensely powerful for collecting citation data, conducting literature reviews, creating bibliographies, and more.
  • roadoi interfaces with Unpaywall, allowing users to input a set of DOIs and return publication information along with potential locations of open access versions.
  • rorcid interfaces with the ORCID API, allowing users to pull publication data based on a specific ORCID iD, or to input names and other identifying information to find a specific individual’s identifier.

As we work through the tutorials, students will continue to learn R functions for working with data, including dplyr, purrr, and tidyr.

By the conclusion of the session, students will be able to work with and analyze data in R. On a deeper level, they will have more powerful tools for gathering subsets of the scholarly literature in clean and structured formats based on specific parameters. Because they will be walking away with executable scripts, they will be able to modify those and collect data based on parameters they are interested in.

Level:

All levels

Intended audience:

This course is intended for scholarly communications librarians, repository managers, research funders, publishers, bibliometricians, and managers of Research Information Management Systems (RIMS).

Requirements:

Students will need a computer with internet access. It will not be necessary to download R or R Studio, as all code will be executed in Jupyter Notebooks in the browser, hosted by binder. Students are required to register for an ORCID iD at https://orcid.org/.

Course Learning Objectives

A participant in this course will, at the end of the course, be able to:

  • Use R to complete a range of data tasks, including understanding R syntax and data types, installing and loading packages, reading data from files and APIs, and executing functions for tidying and analyzing data.
  • Use the rorcid package in R to extract data from ORCID profiles, including authenticating with the ORCID API, finding ORCID iDs by name/affiliation, getting author biographical information, and getting works associated with individuals.
  • Use the rcrossref and roadoi packages in R to extract data from the Crossref and Unpaywall database, including authenticating with the Crossref API, forming queries, getting publication information, getting data on articles, converting articles to BibTeX/RIS, getting citation data, and checking for open access versions.

Course Topics

This course will cover these topics:

  • Introduction to Binder and Jupyter Notebooks
  • Introduction to rcrossref and roadoi
  • Introduction to rorcid

Course Schedule

See the course OSF for Zoom links: https://osf.io/hd4re/

DAY ONE: Wednesday, August 5

Live Zoom Sessions

  • 8-9AM: Introductory session
  • 5-6PM: REPEAT Introductory session

ALL TIMES PACIFIC Convert time

Exercises

Try to complete this by beginning of class, but it’s fine if you push it until after we meet. I’ll be discussing some of this during that session.

1. Using Jupyter Notebooks: 30 minutes

  • This lesson is required. It will cover the basics of what Binder is, what Jupyter Notebooks are, and how to use them.
  • Launch the Using Jupyter Notebooks Jupyter Notebook at Binder
  • Watch the Using Jupyter Notebooks video tutorial (25 min.)

2. Introduction to R: 30 minutes

  • This lesson is optional. It will cover my background, what R is, considerations in adopting R, and some useful help resources.
  • No Jupyter Notebook for this lesson
  • Skim the Introduction to R webpage.

3. R Basics: 1 hour

  • This lesson is required. It will cover getting data into R, exploring and transforming data, particularly using dplyr. Some of these functions will be used in the rcrossref and rorcid tutorials, but they will be explained as we are running through them.
  • Launch the R Basics Jupyter Notebook at Binder
  • Skim the R Basics webpage. Most of this content is covered in the R Basics Jupyter Notebook.
  • Watch the R Basics video tutorial (30 min.)

DAY TWO: Monday, August 10

Live Zoom Sessions

  • 8-9AM: Activity session 1 -
  • 5-6PM: REPEAT Activity session 1

ALL TIMES PACIFIC Convert time

Exercises

5. Exploring Data in Lists: 1 hour

  • This lesson is optional, but highly recommended if you are planning on applying these lessons further. It is a tutorial on using purrr to explore and extract data from lists. Our API calls pull data into our session in nested lists, so this tutorial is helpful for managing that.
  • Launch the Exploring Data in Lists Jupyter Notebook at Binder
  • Skim the Exploring Data in Lists webpage.
  • Watch the Exploring Data in Lists video tutorial (40 mins.)

6. Using rcrossref & roadoi: 1.5 hours

  • This lesson is required. It will cover intro to Crossref, the Crossref API, and rcrossref, getting publication and article data by journal, keyword, and author. Constructing and filtering queries. Writing to CSV, BibTeX, and RIS. Using roadoi to query the Unpaywall API for open access availability. Getting URLs and downloading full text.
  • Launch the rcrossref & roadoi Jupyter Notebook at Binder
  • Skim the * rcrossref webpage. Much of this content is identical to that on the Jupyter Notebook.
  • Watch the rcrossref and roadoi video tutorial (1.25 hrs).

DAY THREE: Wednesday, Aug. 12

Live Zoom Sessions

  • 8-9AM: Activity session 2
  • 5-6PM: REPEAT Activity session 2

ALL TIMES PACIFIC Convert time

Exercises

7. Using rorcid

  • This lesson is required. It will cover authenticating your ORCID key, finding ORCID iDs with names, affiliation, emails, keywords, works; getting and cleaning biographical information, and getting and cleaning employment information.
  • Access the rorcid Jupyter Notebook at Binder
  • Watch the rorcid video tutorial
  • Skim the rorcid webpage. Much of this content is identical to that on the Jupyter Notebook.

Course Materials and Supplies Required

Students will need a computer with internet access, time, patience, and tenacity. No software downloads are required.

Other Resources

The more time you spend reviewing the lessons on the course webpage and practicing R, the better.

Here are some useful cheat sheets:

Package citations

anytime Dirk Eddelbuettel (2020). anytime: Anything to ‘POSIXct’ or ‘Date’ Converter. R package version 0.3.8. https://CRAN.R-project.org/package=anytime

Binder Jupyter et al., “Binder 2.0 - Reproducible, Interactive, Sharable Environments for Science at Scale.” Proceedings of the 17th Python in Science Conference. 2018. https://doi.org/10.25080/Majora-4af1f417-011

dplyr Hadley Wickham, Romain François, Lionel Henry and Kirill Müller (2020). dplyr: A Grammar of Data Manipulation. R package version 1.0.0. https://CRAN.R-project.org/package=dplyr

httpuv Joe Cheng and Winston Chang (2020). httpuv: HTTP and WebSocket Server Library. R package version 1.5.4. https://CRAN.R-project.org/package=httpuv

httr Hadley Wickham (2020). httr: Tools for Working with URLs and HTTP. R package version 1.4.2. https://CRAN.R-project.org/package=httr

janitor Sam Firke (2020). janitor: Simple Tools for Examining and Cleaning Dirty Data. R package version 2.0.1. https://CRAN.R-project.org/package=janitor

jsonlite Jeroen Ooms (2014). The jsonlite Package: A Practical and Consistent Mapping Between JSON Data and R Objects. arXiv:1403.2805 [stat.CO] URL https://arxiv.org/abs/1403.2805.

Jupyter Notebooks Kluyver, Thomas, Benjamin Ragan-Kelley, Fernando Pérez, Brian E. Granger, Matthias Bussonnier, Jonathan Frederic, Kyle Kelley et al. “Jupyter Notebooks-a publishing format for reproducible computational workflows.” In ELPUB, pp. 87-90. 2016. https://eprints.soton.ac.uk/403913/1/STAL9781614996491-0087.pdf

kableExtra Hao Zhu (2019). kableExtra: Construct Complex Table with ‘kable’ and Pipe Syntax. R package version 1.1.0. https://CRAN.R-project.org/package=kableExtra

knitr Yihui Xie (2020). knitr: A General-Purpose Package for Dynamic Report Generation in R. R package version 1.29.

listviewer Jos de Jong, Mac Gainer and Kent Russell (2019). listviewer: ‘htmlwidget’ for Interactive Views of R Lists. R package version 3.0.0. https://CRAN.R-project.org/package=listviewer

lubridate Garrett Grolemund, Hadley Wickham (2011). Dates and Times Made Easy with lubridate. Journal of Statistical Software, 40(3), 1-25. URL http://www.jstatsoft.org/v40/i03/.

magrittr Stefan Milton Bache and Hadley Wickham (2014). magrittr: A Forward-Pipe Operator for R. R package version 1.5. https://CRAN.R-project.org/package=magrittr

png Simon Urbanek (2013). png: Read and write PNG images. R package version 0.1-7. https://CRAN.R-project.org/package=png

purrr Lionel Henry and Hadley Wickham (2020). purrr: Functional Programming Tools. R package version 0.3.4. https://CRAN.R-project.org/package=purrr

R R Core Team (2019). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.

rcrossref Scott Chamberlain, Hao Zhu, Najko Jahn, Carl Boettiger and Karthik Ram (2020). rcrossref: Client for Various ‘CrossRef’ ‘APIs’. R package version 1.0.0. https://CRAN.R-project.org/package=rcrossref

repurrrsive Jennifer Bryan (2019). repurrrsive: Examples of Recursive Lists and Nested or Split Data Frames. R package version 1.0.0. https://CRAN.R-project.org/package=repurrrsive

readr Hadley Wickham, Jim Hester and Romain Francois (2018). readr: Read Rectangular Text Data. R package version 1.3.1. https://CRAN.R-project.org/package=readr

roadoi Najko Jahn (2019). roadoi: Find Free Versions of Scholarly Publications via Unpaywall. R package version 0.6. https://CRAN.R-project.org/package=roadoi

rmarkdown JJ Allaire and Yihui Xie and Jonathan McPherson and Javier Luraschi and Kevin Ushey and Aron Atkins and Hadley Wickham and Joe Cheng and Winston Chang and Richard Iannone (2020). rmarkdown: Dynamic Documents for R. R package version 2.3. URL https://rmarkdown.rstudio.com.

rorcid Scott Chamberlain (2020). rorcid: Interface to the ‘Orcid.org’ API. https://github.com/ropensci/rorcid (devel), https://docs.ropensci.org/rorcid (docs).

RStudio RStudio Team (2020). RStudio: Integrated Development for R. RStudio, PBC, Boston, MA URL http://www.rstudio.com/.

stringr Hadley Wickham (2019). stringr: Simple, Consistent Wrappers for Common String Operations. R package version 1.4.0. https://CRAN.R-project.org/package=stringr

tibble Kirill Müller and Hadley Wickham (2020). tibble: Simple Data Frames. R package version 3.0.3. https://CRAN.R-project.org/package=tibble

tidyr Hadley Wickham and Lionel Henry (2020). tidyr: Tidy Messy Data. R package version 1.1.0. https://CRAN.R-project.org/package=tidyr

usethis Hadley Wickham and Jennifer Bryan (2020). usethis: Automate Package and Project Setup. R package version 1.6.1. https://CRAN.R-project.org/package=usethis