Fetching can be slow, and Entrez will time out requests that take too long.
This helper supports pagination if you specify retmax
.
Usage
efetch(
id_set,
...,
retstart = 0L,
retmax = NA,
retmode = "xml",
rettype = NULL,
.method = NA,
.cookies = NA,
.paginate = 200L,
.process = NA,
.progress = "Fetching",
.path = NULL,
.call = rlang::current_env()
)
Arguments
- id_set
ID set object.
- ...
additional API parameters (refer to Entrez documentation). Any set to
NULL
are removed.- retstart
integer: index of first result (starts from 0).
- retmax
integer: maximum number of results to return. When
NA
this returns all results. WhenNULL
, uses the Entrez default (typically 20). Note that when using pagination with web history, it is possible that slightly more thanretmax
results will be returned.- retmode
character: requested document file format.
- rettype
character: requested document type.
- .method
HTTP verb. If
NA
, a sensible default is chosen based on the request parameters.path to persist cookies. If
NULL
, cookies are not added to the request. For helper functions: whenNA
, a temporary file is created (in this case only, the temporary file will be cleaned up once all requests are performed).- .paginate
controls how multiple API requests are used to complete the call. Pagination is performed using the
retstart
andretmax
API parameters. When set to an integer, no more than.pagniate
items will be requested per API call. WhenFALSE
or0
, only one API request is sent.- .process
function that processes the API results. Can be a function or builtin processor as described in
process
. Additional builtin processors are available:"uilist"
to extract a list of IDs (suitable forrettype = "uilist"
),NA
to use a sensible choice based on parameters. In particular, for"uilist"
requests, it will return anid_list
object.
- .progress
controls progress bar; see the
progress
argument ofhttr2::req_perform_iterative()
.- .path
path specification for saving raw responses. See
path
argument ofhttr2::req_perform_iterative()
.- .call
call environment to use in error messages/traces. See rlang::topic-error-call and the
call
argument ofcli::cli_abort()
. You only need to specify this in internal helper functions that don't need to be mentioned in error messages.
Value
output of .process
from each page of results, combined with vctrs::list_unchop()
.