Applies some name-cleaning heuristics to facilitate joins. These heuristics may include:
removing periods and apostrophes
removing common suffixes, such as Jr, Sr, II, III, IV
converting to lowercase
using
dp_name_mapping
to do common name substitutions, such as Mitch Trubisky to Mitchell Trubisky
Usage
dp_cleannames(
player_name,
lowercase = FALSE,
convert_lastfirst = TRUE,
use_name_database = TRUE
)
dp_clean_names(
player_name,
lowercase = FALSE,
convert_lastfirst = TRUE,
use_name_database = TRUE
)
Arguments
- player_name
a character (or character vector)
- lowercase
defaults to FALSE - if TRUE, converts to lowercase
- convert_lastfirst
converts names from "Last, First" to "First Last" (i.e. MFL style)
- use_name_database
uses internal name database to do common substitutions (Mitchell Trubisky to Mitch Trubisky etc)
Examples
# \donttest{
dp_cleannames(c("A.J. Green", "Odell Beckham Jr.", "Le'Veon Bell Sr."))
#> [1] "AJ Green" "Odell Beckham" "LeVeon Bell"
dp_cleannames(c("Trubisky, Mitch", "Atwell, Chatarius", "Elliott, Zeke", "Elijah Moore"),
convert_lastfirst = TRUE,
use_name_database = TRUE
)
#> [1] "Mitchell Trubisky" "Tutu Atwell" "Ezekiel Elliott"
#> [4] "Elijah Moore"
# }