cr_types | R Documentation |
Search CrossRef types
cr_types( types = NULL, query = NULL, filter = NULL, offset = NULL, limit = NULL, sample = NULL, sort = NULL, order = NULL, facet = FALSE, works = FALSE, cursor = NULL, cursor_max = 5000, .progress = "none", flq = NULL, select = NULL, ... ) cr_types_( types = NULL, query = NULL, filter = NULL, offset = NULL, limit = NULL, sample = NULL, sort = NULL, order = NULL, facet = FALSE, works = FALSE, cursor = NULL, cursor_max = 5000, .progress = "none", parse = FALSE, flq = NULL, select = NULL, ... )
types |
(character) Type identifier, e.g., journal |
query |
Query terms |
filter |
Filter options. See examples for usage examples
and |
offset |
Number of record to start at. Minimum: 1. For
|
limit |
Number of results to return in the query. Not relavant when searching with specific dois. Default: 20. Max: 1000 |
sample |
(integer) Number of random results to return. when you use
the sample parameter, the rows and offset parameters are ignored.
Ignored unless |
sort |
Field to sort on. Acceptable set of fields to sort on:
|
order |
(character) Sort order, one of 'asc' or 'desc' |
facet |
(logical) Include facet results. Boolean or string with
field to facet on. Valid fields are *, affiliation, funder-name,
funder-doi, orcid, container-title, assertion, archive, update-type,
issn, published, source, type-name, publisher-name, license,
category-name, assertion-group. Default: |
works |
(logical) If |
cursor |
(character) Cursor character string to do deep paging.
Default is None. Pass in '*' to start deep paging. Any combination of
query, filters and facets may be used with deep paging cursors.
While the |
cursor_max |
(integer) Max records to retrieve. Only used when
cursor param used. Because deep paging can result in continuous requests
until all are retrieved, use this parameter to set a maximum number of
records. Of course, if there are less records found than this value,
you will get only those found. When cursor pagination is being used
the |
.progress |
Show a |
flq |
field queries. One or more field queries. Acceptable set of field query parameters are:
Note: |
select |
(character) One or more field to return (only those fields are returned) |
... |
Named parameters passed on to |
parse |
(logical) Whether to output json |
BEWARE: The API will only work for CrossRef DOIs.
When using the cursor, a character string called next-cursor
is
returned from Crossref that we use to do the next request, and so on. We
use a while loop to get number of results up to the value of
cursor_max
. Since we are doing each request for you, you may not
need the next-cursor
string, but if you do want it, you can get
to it by indexing into the result like x$meta$next_cursor
Note that you can pass in curl options when using cursor, via "..."
See the "Rate limiting" seciton in rcrossref to get into the "fast lane"
https://github.com/CrossRef/rest-api-doc
Other crossref:
cr_funders()
,
cr_journals()
,
cr_licenses()
,
cr_members()
,
cr_prefixes()
,
cr_works()
## Not run: cr_types() cr_types("monograph") cr_types("monograph", works=TRUE) cr_types(c('monograph', 'book-set', 'book', 'book-track')) cr_types(c('monograph', 'book-set'), works=TRUE) ## get facets back cr_types("journal-article", works=TRUE, facet=TRUE)$facets cr_types("monograph", works=TRUE, facet="license:*", limit = 0) cr_types(c('monograph', 'book-set'), works=TRUE, facet=TRUE) # Use the cursor for deep paging cr_types("journal-article", works = TRUE, cursor = "*", cursor_max = 500, limit = 100) cr_types(c('monograph', 'book-set'), works = TRUE, cursor = "*", cursor_max = 300, limit = 100) ## with optional progress bar cr_types("journal-article", works = TRUE, cursor = "*", cursor_max = 500, limit = 100, .progress = TRUE) # query doesn't work unless using works=TRUE ### you get results, but query param is silently dropped cr_types(query = "ecology") # print progress - only works when passing more than one type cr_types(c('monograph', 'book-set'), works=TRUE, .progress='text') # Low level function - does no parsing to data.frame, get json or a list cr_types_('monograph') cr_types_('monograph', parse = TRUE) cr_types_("journal-article", works = TRUE, cursor = "*", cursor_max = 300, limit = 100) # field queries ## query.container-title cr_types("journal-article", works = TRUE, flq = c(`query.container-title` = 'Ecology')) # select only certain fields to return res <- cr_types("journal-article", works = TRUE, select = c('DOI', 'title')) names(res$data) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.