i need to remove a certain part of string if it's a exact match with a couple of keys. For example in my dataframe i have the string "PCPSERGIO AUGUSTO DOS SANTOS" i need to remove the PCP at the start of this but not change remove any "p" from "FATURA - PHENIX".
example:
x <- c("PCPSERGIO AUGUSTO DOS SANTOS","FATURA - PHENIX")
x <- removestr(x,"[PCP]")
x
[1] "SERGIO AUGUSTO DOS SANTOS" "FATURA - PHENIX"
i have tried using the str_remove function as well as the gsub function.
df <- str_remove_all(df,"[PcP]")