rcoreoa - Client for the CORE API (https://core.ac.uk/docs/). CORE (https://core.ac.uk) aggregates open access research outputs from repositories and journals worldwide and make them available to the public.

Installation

The package can be installed directly from the CRAN repository:

install.packages("rcoreoa")

Or you can install the development version:

remotes::install_github("ropensci/rcoreoa")

Once the package is installed, simply run:

Obtaining an API key

The Core API requires an API key, and, as such, requires you to register for the key on the Core Website (https://core.ac.uk/api-keys/register). Once you register with your email address you will be sent an API key that looks a little like this:

thisISyourAPIkeyITlooksLIKEaLONGstringOFletters

Using the API Key

Best practice is to set the API key as an environment variable for your system, and then call it in R using Sys.getenv(). If you set the parameter in .Renviron it is permanently available to your R sessions. See ?Startup. Be aware that if you are using version control you do not want to commit the .Renviron file in your local directory. Either edit your global .Renviron file, or make sure that .Renviron is added to your .gitignore file.

Within the .Renviron file you will add:

CORE_KEY=thisISyourAPIkeyITlooksLIKEaLONGstringOFletters

The key may also be included in a file such as a .bash_profile file, or elsewhere. Users may decide which works best for them. Once you’ve added the API key, restart your R session and test to make sure the key has been added using the command:

Sys.getenv("CORE_KEY")

If you get this to work, you’re doing great and we can move on to the next section. If this is still not working for you, check to make sure you have saved the .Renviron file, that it is in the same directory as your current project’s working directory, and that the name you have given the variable in the .Renviron file is the same as the name you are calling in Sys.getenv().

An Introduction to the Functions

The rcoreoa package accesses CORE’s API to facilitate open text searching. The API allows an individual to search for articles based on text string searches using core_search(). Given a set of article IDs from the core_search(), users can then find more bibliographic information on the article (core_articles()) and article publishing history (core_articles_history()), on the journals in which the article was published (core_journals()).

All of the functions return structured R objects, but can return JSON character strings by appending an unerscore (_) to the function name. We will illustrate the difference:

core_journals(id = '2167-8359')
#> $status
#> [1] "OK"
#> 
#> $data
#> $data$title
#> [1] "PeerJ"
#> 
#> $data$identifiers
#> [1] "oai:doaj.org/journal:576e4d34b8bf461bb586f1e90d80d7cc"
#> [2] "issn:2167-8359"                                       
#> [3] "url:https://doaj.org/toc/2167-8359"                   
#> 
#> $data$subjects
#> [1] "biomedical" "health"     "genetics"   "ecology"    "biology"   
#> [6] "Medicine"   "R"         
#> 
#> $data$language
#> [1] "EN"
#> 
#> $data$rights
#> [1] "CC BY"
#> 
#> $data$publisher
#> [1] "PeerJ Inc."

And with the underscore:

core_journals_(id = '2167-8359')
#> [1] "{\"status\":\"OK\",\"data\":{\"title\":\"PeerJ\",\"identifiers\":[\"oai:doaj.org\\/journal:576e4d34b8bf461bb586f1e90d80d7cc\",\"issn:2167-8359\",\"url:https:\\/\\/doaj.org\\/toc\\/2167-8359\"],\"subjects\":[\"biomedical\",\"health\",\"genetics\",\"ecology\",\"biology\",\"Medicine\",\"R\"],\"language\":\"EN\",\"rights\":\"CC BY\",\"publisher\":\"PeerJ Inc.\"}}"

Through this Vignette we will illustrate some of the tools available as part of the package within a workflow that seeks to perform some basic bibliometric analysis.

high- vs. low-level interfaces

Each function has a higher level interface that does HTTP request for data and parses the JSON using jsonlite. This is meant for those who want everything done for them, but there’s a time penalty for as the parsing adds extra time. If you just want raw JSON unparsed text, you can use the low level interface.

The low level version of each function has _ at the end (e.g., core_search_), while the high level version doesn’t have the _ (e.g., core_search).

The high level version of each function uses the low level method, and the low level method does all the logic and HTTP requesting, whereas the high level simply parses the output.

Articles

core_articles(id = 21132995)
#> $status
#> [1] "OK"
#> 
#> $data
#> $data$id
#> [1] "21132995"
#> 
#> $data$authors
#> list()
#> 
#> $data$contributors
#> [1] "The Pennsylvania State University CiteSeerX Archives"
#> 
#> $data$datePublished
#> [1] "2010-02-17"
#> 
#> $data$description
#> [1] "Abstract. This paper discusses the potential contribution of an eco-theology to the management of marine resources. The claim of the Christian gospel is that God has a plan for everything in the universe and we are to live to bring it about. The Hebrew/Christian world view is significantly different from naturalism and humanism, the prevailing Greek world views in natural resource management. Three biblical paradigms are examined with insights into key elements in the management of fisheries: dominion; regulation and valuation and caring. In dominion we see the strength of mankind's rule over other species, including fish, misused. Fisheries management generally fails to reign in this driving force, rewarding greed while calling for restraint. Regulation and its impact on mindsets and behaviour, is a theme evident in the Old and New Testaments- entering the promised land, keeping the law and caring for others, both humans and fish. The biblical view also emphasises life, death and resurrection as the process seen in nature. New fishery management paradigms may only develop after old ways and attitudes have died. Significant attitudinal change is essential to improve fisheries management and to achieve new management arrangements. Improved fishery stewardship may require "a new fisher", relationally mature and societally accountable, to achieve the goals of sustainable fishery management through a variety of policy paradigms. The Christian world view promotes such attitudinal change to improve stewardship through reconciling issues in our relationship with God, neighbours and nature. It is worthy of further investigation"
#> 
#> $data$identifiers
#> [1] "oai:CiteSeerX.psu:10.1.1.152.9831" NA                                 
#> 
#> $data$relations
#> list()
#> 
#> $data$repositories
#>    id openDoarId      name uri urlHomepage urlOaipmh uriJournals physicalName
#> 1 145          0 CiteSeerX  NA          NA        NA          NA       noname
#>   source software metadataFormat description journal roarId pdfStatus nrUpdates
#> 1     NA       NA             NA          NA      NA      0        NA         0
#>   disabled lastUpdateTime repositoryLocation
#> 1    FALSE             NA                 NA
#> 
#> $data$repositoryDocument
#> $data$repositoryDocument$pdfStatus
#> [1] 0
#> 
#> $data$repositoryDocument$metadataAdded
#> [1] 1.413993e+12
#> 
#> $data$repositoryDocument$metadataUpdated
#> [1] 1.529412e+12
#> 
#> $data$repositoryDocument$depositedDate
#> [1] 1.266365e+12
#> 
#> 
#> $data$subjects
#> [1] "text"
#> 
#> $data$topics
#> [1] "Ecology"              "Theology"             "Eco-theology"        
#> [4] "Fisheries Management"
#> 
#> $data$types
#> list()
#> 
#> $data$year
#> [1] 2010
#> 
#> $data$oai
#> [1] "oai:CiteSeerX.psu:10.1.1.152.9831"
#> 
#> $data$downloadUrl
#> [1] ""

Article history

core_articles_history(id = '21132995')
#> $status
#> [1] "OK"
#> 
#> $data
#>              datetime
#> 1 2016-08-03 00:13:41
#> 2 2014-10-22 16:42:14
#>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               metadata
#> 1                                                                                                               <record><header><identifier>\n    \n      \n        oai:CiteSeerX.psu:10.1.1.152.9831</identifier><datestamp>\n        2010-02-17</datestamp>\n      </header><metadata><oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd" ><dc:title>\n      \n        \n          </dc:title><dc:subject>\n          Ecology</dc:subject><dc:subject>\n          Theology</dc:subject><dc:subject>\n          Eco-theology</dc:subject><dc:subject>\n          Fisheries Management</dc:subject><dc:description>\n          Abstract. This paper discusses the potential contribution of an eco-theology to the management of marine resources. The claim of the Christian gospel is that God has a plan for everything in the universe and we are to live to bring it about. The Hebrew/Christian world view is significantly different from naturalism and humanism, the prevailing Greek world views in natural resource management. Three biblical paradigms are examined with insights into key elements in the management of fisheries: dominion; regulation and valuation and caring. In dominion we see the strength of mankind&apos;s rule over other species, including fish, misused. Fisheries management generally fails to reign in this driving force, rewarding greed while calling for restraint. Regulation and its impact on mindsets and behaviour, is a theme evident in the Old and New Testaments- entering the promised land, keeping the law and caring for others, both humans and fish. The biblical view also emphasises life, death and resurrection as the process seen in nature. New fishery management paradigms may only develop after old ways and attitudes have died. Significant attitudinal change is essential to improve fisheries management and to achieve new management arrangements. Improved fishery stewardship may require &quot;a new fisher&quot;, relationally mature and societally accountable, to achieve the goals of sustainable fishery management through a variety of policy paradigms. The Christian world view promotes such attitudinal change to improve stewardship through reconciling issues in our relationship with God, neighbours and nature. It is worthy of further investigation.</dc:description><dc:contributor>\n          The Pennsylvania State University CiteSeerX Archives</dc:contributor><dc:publisher>\n          </dc:publisher><dc:date>\n          2010-02-17</dc:date><dc:date>\n          2010-02-17</dc:date><dc:format>\n          application/pdf</dc:format><dc:type>\n          text</dc:type><dc:identifier>\n          http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.152.9831</dc:identifier><dc:source>\n          http://www.orst.edu/Dept/IIFET/2000/papers/mcilgorm.pdf</dc:source><dc:language>\n          en</dc:language><dc:rights>\n          Metadata may be used without restrictions as long as the oai identifier remains attached to it.</dc:rights>\n        </oai_dc:dc>\n      </metadata>\n    </record>
#> 2 <record><header><identifier>\n        \n      \n    \n    \n      \n        oai:CiteSeerX.psu:10.1.1.152.9831</identifier><datestamp>\n        2010-02-17</datestamp>\n      </header><metadata><oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd" ><dc:title>\n      \n      \n        \n          </dc:title><dc:subject>\n      \n      \n        \n          \n          Ecology</dc:subject><dc:subject>\n          Theology</dc:subject><dc:subject>\n          Eco-theology</dc:subject><dc:subject>\n          Fisheries Management</dc:subject><dc:description>\n          Abstract. This paper discusses the potential contribution of an eco-theology to the management of marine resources. The claim of the Christian gospel is that God has a plan for everything in the universe and we are to live to bring it about. The Hebrew/Christian world view is significantly different from naturalism and humanism, the prevailing Greek world views in natural resource management. Three biblical paradigms are examined with insights into key elements in the management of fisheries: dominion; regulation and valuation and caring. In dominion we see the strength of mankind&apos;s rule over other species, including fish, misused. Fisheries management generally fails to reign in this driving force, rewarding greed while calling for restraint. Regulation and its impact on mindsets and behaviour, is a theme evident in the Old and New Testaments- entering the promised land, keeping the law and caring for others, both humans and fish. The biblical view also emphasises life, death and resurrection as the process seen in nature. New fishery management paradigms may only develop after old ways and attitudes have died. Significant attitudinal change is essential to improve fisheries management and to achieve new management arrangements. Improved fishery stewardship may require &quot;a new fisher&quot;, relationally mature and societally accountable, to achieve the goals of sustainable fishery management through a variety of policy paradigms. The Christian world view promotes such attitudinal change to improve stewardship through reconciling issues in our relationship with God, neighbours and nature. It is worthy of further investigation.</dc:description><dc:contributor>\n          The Pennsylvania State University CiteSeerX Archives</dc:contributor><dc:publisher>\n          </dc:publisher><dc:date>\n          \n          2010-02-17</dc:date><dc:date>\n          2010-02-17</dc:date><dc:format>\n          application/pdf</dc:format><dc:type>\n          text</dc:type><dc:identifier>\n          http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.152.9831</dc:identifier><dc:source>\n          http://www.orst.edu/Dept/IIFET/2000/papers/mcilgorm.pdf</dc:source><dc:language>\n          en</dc:language><dc:rights>\n          Metadata may be used without restrictions as long as the oai identifier remains attached to it.</dc:rights>\n        </oai_dc:dc>\n        \n      </metadata>\n        \n      \n    </record>

Journals

core_journals(id = '2220-721X')

Get PDFs

The _ for these methods means that you get a file path back to the PDF, while the high level version without the _ parses the pdf to text for you.