You can have it simpler: gsub("A$|B$", "", c("Stage II" , "Stage IVA" ,"Stage IIIB" ,"ACB" ))
That reads as "replace all A's and B's if they're the trailing character (that is what $ means, so last character).
• 0 views
•
link