Skip to contents

Accepts an optional PMID: prefix. Input that is not a bare run of digits after the prefix is rejected as NA rather than coerced, so a PMCID or DOI placed in a PMID field is not silently turned into a fabricated PMID.

Usage

normalize_pmid(x)

Arguments

x

A character (or numeric) vector of PMIDs, optionally PMID:-prefixed.

Value

A character vector of digit-only PMIDs, NA where none is present.

Examples

normalize_pmid("PMID: 12345678")
#> [1] "12345678"
normalize_pmid("PMC12345")  # NA: a PMCID is not a PMID
#> [1] NA