View source: R/object_retrieval.R
object_retrieval | R Documentation |
This function wraps generic_elsevier_api
to
give a
retrieval of an object from the Elsevier Object Retrieval API
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
generic_elsevier_api
api_key = get_api_key(NULL, error = FALSE)
authorized = is_elsevier_authorized()
if (have_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 ]
}
if (authorized) {
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.