Skip to contents

Convert an input string to the most likely property PID

Usage

as_pid(x)

Arguments

x

a vector, data frame, or tibble of strings representing Wikidata properties

Value

If the inputted string is a valid PID, return the string. If the inputted string matches a property label, return its PID. If the inputted string matches multiple labels of multiple properties, return the PID of the first hit.

Examples

# if input string is a valid PID
as_pid("P50")
#> # A tibble: 1 × 1
#>   x    
#>   <chr>
#> 1 P50  
# if input string matches multiple item labels
as_pid("author")
#> # A tibble: 1 × 1
#>   x    
#>   <chr>
#> 1 P50  
# if input string matches a single unique label
as_pid("Scopus author ID")
#> # A tibble: 1 × 1
#>   x    
#>   <chr>
#> 1 P1153