I have a vector of strings like below:
x <- c("AA.3", "BEAM.2", "BRK.B", "BF.B", "CB.1", "DD.2",
"IGT.1", "LSI.1", "NSM.2", "PLL.1", "SUN.1", "DTV.2",
"ALTR.1", "NVLS.1", "AGN.2", "CPWR.1", "LIFE.3", "FTI.1",
"SE.7", "MMI.3", "ABC", "AS.")
I need to trim these strings. For the strings ending with a dot and number (.1 for example), remove the dot and number. For strings ending with a dot, remove the dot. For the strings ending with a dot and letter (.B for example), do not change them. For other strings, do not change them.
I am looking at the stri_trim_right function from the package stringi, but could not figure out how to do it.