I have a question:
The rules for the arguments of str_replace_all() are not fully clear to me. Because I would like to find different patterns in a character vector, truncate the match and replace the match with the first part of the match:
(words <- c( "axapplexe", "baxanaxanaxa", "coxocoxonuxut", "froxoppylaxand"))
with the result hopefully being c("apple", "banana", "coconut", "froppyland")
so i want to split the match at a certain letter and use the part before that certain letter as replacement. But this doesnt seem to work. Does anyone have a tip about this? I have also tried for example other replacements like replacement = tolower("\\1"), which also didnt work.
Thanks a lot