Hello, I have a corpus named 'test', filled with character strings, and I'd like to remove the last character from each string ONLY if it is a vowel. The current code I'm working with is this:
library(stringr)
look_for <- "[aeioy]$"
replace_with <- ""
textone <- "No hay morors en la costa"
texttwo <- "The coast is clear."
str_replace(textone, look_for, replace_with)
#> [1] "No hay morors en la cost"
str_replace(texttwo, look_for, replace_with)
#> [1] "The coast is clear."
(The purpose of defining the search and replace arguments is re-using the code as a snippet.) Created on 2020-04-09 by the reprex package (v0.3.0)