core_journals: Get journal via its ISSN

View source: R/core_journals.R

core_journalsR Documentation

Get journal via its ISSN

Description

Get journal via its ISSN

Usage

core_journals(id, key = NULL, method = "GET", parse = TRUE, ...)

core_journals_(id, key = NULL, method = "GET", ...)

core_repos_(id, key = NULL, method = "GET", ...)

Arguments

id

(integer) One or more journal ISSNs. Required

key

A CORE API key. Get one at https://core.ac.uk/api-keys/register. Once you have the key, you can pass it into this parameter, or as a much better option, store your key as an environment variable with the name CORE_KEY or an R option as core_key. See ?Startup for how to work with env vars and R options

method

(character) one of 'GET' (default) or 'POST'

parse

(logical) Whether to parse to list (FALSE) or data.frame (TRUE). Default: TRUE

...

Curl options passed to HttpClient

Details

core_journals does the HTTP request and parses, while core_journals_ just does the HTTP request, gives back JSON as a character string

These functions take one article ID at a time. Use lapply/loops/etc for many ids

References

https://core.ac.uk/docs/#!/journals/getJournalByIssnBatch https://core.ac.uk/docs/#!/journals/getJournalByIssn

Examples

## Not run: 
core_journals(id = '2167-8359')

ids <- c("2167-8359", "2050-084X")
res <- lapply(ids, core_journals)
vapply(res, "[[", "", c("data", "title"))

# just http request, get text back
core_journals_('2167-8359')

# post request, ideal for lots of ISSNs
if (requireNamespace("rcrossref", quietly = TRUE)) {
 library(rcrossref)
 res <- lapply(c("bmc", "peerj", "elife", "plos", "frontiers"), function(z)
    cr_journals(query = z))
 ids <- na.omit(unlist(lapply(res, function(b) b$data$issn)))
 out <- core_journals(ids, method = "POST")
 head(out)
}


## End(Not run)

ropensci/rcoreoa documentation built on Sept. 14, 2022, 9:50 a.m.