Skip to contents

This function checks if a given list of DOIs exist by sending HTTP requests to the DOI resolver.

Usage

doi_exists(dois, cache_file = NULL)

Arguments

dois

A character vector of DOIs to check.

cache_file

A file name of the cache to be used, i.e. the confirmed existing dois. The format is a character vector with the DOIs which exist. If the cache exist, it will be updated at the end. Temporary caches will be written after 100 checks.

Value

A named logical vector indicating whether each DOI does exist or not, names are the dois.

Details

This function uses the httr package to send HTTP GET requests to the DOI resolver and checks the response status code. A status code of 200 indicates that the DOI exists, while any other status code indicates that the DOI does not exist.

Examples

dois <- c("sbcd1234", "10.1234/abcd", "10.1002/jcb.23190", "10.47366/sabia.v5n1a3")
doi_exists(dois)
#> 
#> Progress: 1 of 
#> 
#> Progress: 2 of 
#> Waiting 2s for throttling delay ■■■■■■■■■■■■■■■                 
#> Waiting 2s for throttling delay ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  
#> 
#> Progress: 3 of 
#> 
#> Progress: 4 of 
#> Waiting 2s for throttling delay ■■■■■■■■■■■■■■■                 
#> Waiting 2s for throttling delay ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  
#>              sbcd1234          10.1234/abcd     10.1002/jcb.23190 
#>                 FALSE                 FALSE                 FALSE 
#> 10.47366/sabia.v5n1a3 
#>                  TRUE 
# Output: [1] FALSE  TRUE