Type-/length-stable, defensive and cached variant of rcrossref::cr_works().

cr_works2(x, ...)

Arguments

x

A vector created by, or convertable to doi().

...

Arguments passed on to rcrossref::cr_works

dois

Search by a single DOI or many DOIs. Note that using this parameter at the same time as the query, limit, select or flq parameter will result in an error.

query

Query terms

filter

Filter options. See examples for usage examples and filters for what filters are available. filter is available for use with cr_works and other crossref family functions with works=TRUE

offset

Number of record to start at. Minimum: 1. For cr_works, and any function setting works = TRUE, the maximum offset value is 10000. For larger requests use cursor.

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 works=TRUE. Max: 100

sort

Field to sort on. Acceptable set of fields to sort on:

  • score OR relevance - Sort by relevance score

  • updated - Sort by date of most recent change to metadata. Currently the same as deposited.

  • deposited - Sort by time of most recent deposit

  • indexed - Sort by time of most recent index

  • published - Sort by publication date

  • published-print - Sort by print publication date

  • published-online - Sort by online publication date

  • issued - Sort by issued date (earliest known publication date)

  • is-referenced-by-count - Sort by number of times this DOI is referenced by other Crossref DOIs

  • references-count - Sort by number of references included in the references section of the document identified by this DOI

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: FALSE

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 limit parameter may be specified along with cursor, offset and sample cannot be used with the cursor. See https://github.com/CrossRef/rest-api-doc#deep-paging-with-cursors

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 limit parameter sets the chunk size per request.

.progress

Show a plyr-style progress bar? Options are "none", "text", "tk", "win", and "time". See create_progress_bar for details of each. Only used when passing in multiple ids (e.g., multiple DOIs, DOI prefixes, etc.), or when using the cursor param. When using the cursor param, this argument only accept a boolean, either TRUE or FALSE; any non-boolean is coerced to FALSE.

flq

field queries. One or more field queries. Acceptable set of field query parameters are:

  • query.container-title - Query container-title aka. publication name

  • query.author - Query author first and given names

  • query.editor - Query editor first and given names

  • query.chair - Query chair first and given names

  • query.translator - Query translator first and given names

  • query.contributor - Query author, editor, chair and translator first and given names

  • query.bibliographic - Query bibliographic information, useful for citation lookup. Includes titles, authors, ISSNs and publication years

  • query.affiliation - Query contributor affiliations

Note: query.title has been removed - use query.bibliographic as a replacement

select

(character) One or more field to return (only those fields are returned)

async

(logical) use async HTTP requests. Default: FALSE

Details

This wrapper changes the underlying behavior as follows:

  • vectorised by purrr::map_dfr()

  • all warnings and empty returned rows are raised to errors

  • returns type stably and length stably (in rows)

  • caches individual DOI results

  • retries on failed attempts

  • returns only the data element

This function is still defensive; it will error out if attempts fail or inputs are bad. That is what makes it type stable/length stable. It is the callers responsibility to use purrr::possibly(), and recover from errors by giving some otherwise default. This cannot be done here, because the caller must determine what a useful default is. This weirdness can be resolved when we always test and return individual fields as per https://github.com/subugoe/metacheck/issues/183.

See also

Other import: get_cr_md(), pretests()