Description Usage Arguments Value See Also Examples
View source: R/object_retrieval.R
This function wraps generic_elsevier_api
to
give a
retrieval of an object from the Elsevier Object Retrieval API
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, ...)
|
id |
Identifier for object |
identifier |
Type of identifier to use |
ref |
document reference |
http_end |
any additional end to http statement.
See |
... |
Arguments to be passed to |
res |
result from |
url |
url to download from |
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 |
List of elements, similar to generic_elsevier_api
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))
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.