Skip to content

Commit

Permalink
clean_name Dr. fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pgomba committed Feb 11, 2024
1 parent 0a5ae77 commit bfa2223
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/clean_names.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ clean_names <- function(name_vector) {
cleaned_names<-name_vector%>%
tolower()%>% #all letter to lower case
gsub("-"," ",.) %>% #replace hyphens with space
gsub("dr. |prof. |prof. dr. |assoc. prof. | \\u2020","",.) %>% #remove titles and symbols, including ASCII code for †
gsub("\\bdr\\.\\s*|prof. |prof. dr. |assoc. prof. | \\u2020","",.) %>% #remove titles and symbols, including ASCII code for †
gsub("\\b\\w\\.\\s*", "", .)%>% #remove abbreviated middle names
word(start = 1,end = 2)%>% #Keep two first items of names to avoid problems with second surname
str_squish() #remove accidental white spaces
Expand All @@ -24,3 +24,5 @@ clean_names <- function(name_vector) {

}



0 comments on commit bfa2223

Please sign in to comment.