df <- data.frame(name = c("RAMOREYDR","SAMUEL MR","MR KOOL","HANDSOMEDR","GELLER DR","SONIA MS"))
df
# name
# 1 RAMOREYDR
# 2 SAMUEL MR
# 3 MR KOOL
# 4 HANDSOMEDR
# 5 GELLER DR
# 6 SONIA MS
df$Clean_Name <- gsub(" MR|MR|MR | MS|MS|MS | DR|DR|DR ", "", df$name)
df
# name Clean_Name
# 1 RAMOREYDR RAMOREY
# 2 SAMUEL MR SAMUEL
# 3 MR KOOL KOOL
# 4 HANDSOMEDR HANDSOME
# 5 GELLER DR GELLER
# 6 SONIA MS SONIA
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…