object_retrieval: ScienceDirect Object Retrieval

Description Usage Arguments Value See Also Examples

View source: R/object_retrieval.R

Description

This function wraps generic_elsevier_api to give a retrieval of an object from the Elsevier Object Retrieval API

Usage

1
2
3
4
5
6
7
8
9
object_retrieval(id, identifier = c("scopus_id", "eid", "doi", "pii",
  "pubmed_id"), ref = NULL, http_end = NULL, ...)

process_object_retrieval(res)

download_object(url, api_key = NULL, api_key_error = TRUE,
  verbose = TRUE, headers = NULL, ...)

download_objects(url, ...)

Arguments

id

Identifier for object

identifier

Type of identifier to use

ref

document reference

http_end

any additional end to http statement. See generic_elsevier_api

...

Arguments to be passed to generic_elsevier_api or GET

res

result from object_retrieval

url

url to download from object_retrieval

api_key

Elsevier API key

api_key_error

Should there be an error if no API key?

verbose

Print messages from specification

headers

Headers passed to add_headers, passed to GET

Value

List of elements, similar to generic_elsevier_api

See Also

generic_elsevier_api

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
api_key = get_api_key(NULL, error = FALSE)
if (!is.null(api_key)){
   x = object_retrieval("S1053811915002700", identifier = "pii",
   verbose = FALSE)
   df = process_object_retrieval(x)
   df = df[ grepl("image/jpeg", df$mime_type),,drop = FALSE ]
   df = df[ df$type %in% "IMAGE-HIGH-RES",,drop = FALSE ]
   res = download_object(df$url[1])
   if (interactive()) {
      browseURL(res$outfile)
   } else {
     img = res$content
     dims = dim(img)[1:2]
     mdim = max(dims)
     graphics::plot(c(0, ncol(img)), c(0, nrow(img)), type='n')
     graphics::rasterImage(img, 1, 1, ncol(img), nrow(img))
   }
}

Example output



rscopus documentation built on Sept. 18, 2019, 1:03 a.m.