This function extracts the DOI or DOIs from a character vector. It always returns a single DOI for each element in the input vector (if one is found), but returns additional DOIs in the attributes.

extract_doi(x)

Arguments

x

The character vector.

Value

A character vector.

Examples

exampleVector <-
  c("eni040 [pii] and 10.1093/deafed/eni040 [doi]",
    "S0022437503000938 [pii] and 10.1016/j.jsr.2003.12.001 [doi]",
    NA,
    "10.1080/15428119791012261 [doi]");
metabefor::extract_doi(
  exampleVector
);
#> [1] "10.1093/deafed/eni040"     "10.1016/j.jsr.2003.12.001"
#> [3] NA                          "10.1080/15428119791012261"
#> attr(,"hasAdditional")
#> [1] FALSE FALSE FALSE FALSE
#> attr(,"additional")
#> [1] NA NA NA NA