core_articles: Get articles

Description Usage Arguments Details References Examples

View source: R/core_articles.R

Description

Get articles

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
core_articles(
  id,
  metadata = TRUE,
  fulltext = FALSE,
  citations = FALSE,
  similar = FALSE,
  duplicate = FALSE,
  urls = FALSE,
  extractedUrls = FALSE,
  faithfulMetadata = FALSE,
  key = NULL,
  method = "GET",
  parse = TRUE,
  ...
)

core_articles_(
  id,
  metadata = TRUE,
  fulltext = FALSE,
  citations = FALSE,
  similar = FALSE,
  duplicate = FALSE,
  urls = FALSE,
  extractedUrls = FALSE,
  faithfulMetadata = FALSE,
  key = NULL,
  method = "GET",
  ...
)

Arguments

id

(integer) CORE ID of the article that needs to be fetched. Required

metadata

Whether to retrieve the full article metadata or only the ID. Default: TRUE

fulltext

Whether to retrieve full text of the article. Default: FALSE

citations

Whether to retrieve citations found in the article. Default: FALSE

similar

Whether to retrieve a list of similar articles. Default: FALSE Because the similar articles are calculated on demand, setting this parameter to true might slightly slow down the response time query

duplicate

Whether to retrieve a list of CORE IDs of different versions of the article. Default: FALSE

urls

Whether to retrieve a list of URLs from which the article can be downloaded. This can include links to PDFs as well as HTML pages. Default: FALSE

extractedUrls

Whether to retrieve a list of URLs which were extracted from the article fulltext. Default: FALSE. This parameter is not available in CORE API v2.0 beta

faithfulMetadata

Whether to retrieve the raw XML metadata of the article. Default: FALSE

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_articles does the HTTP request and parses, while core_articles_ 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/#!/articles/getArticleByCoreIdBatch https://core.ac.uk/docs/#!/articles/getArticleByCoreId

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
core_articles(id = 21132995)
core_articles(id = 21132995, fulltext = TRUE)
core_articles(id = 21132995, citations = TRUE)

# when passing >1 article ID
ids <- c(20955435, 21132995, 21813171, 22815670, 23828884,
   23465055, 23831838, 23923390, 22559733)
## you can use method="GET" with lapply or similar
res <- lapply(ids, core_articles)
vapply(res, "[[", "", c("data", "datePublished"))

## or use method="POST" passing all at once
res <- core_articles(ids, method = "POST")
head(res$data)
res$data$authors

# just http request, get text back
core_articles_(id = '21132995')
## POST, can pass many at once
core_articles_(id = ids, method = "POST")

## End(Not run)

rcoreoa documentation built on July 8, 2020, 7:30 p.m.