I have this dataset:
datasample <- data.frame(id = c(1,2,3),
prod = c("__eggs",
"fresh <br> turkey",
"meat tosón"))
And I want to clean the prod
variable. In this case to extract the <br>
tag and to convert the "tosón" text to "toson". I read in SO the solution for the accented characters: Convert accented characters into ascii character so I tried this code:
data <- datasample %>%
mutate(prod = str_replace(prod, "__", ""),
prod = str_replace(prod, "<br>", ""),
prod = iconv(prod, to="ASCII//TRANSLIT"))
But this is the result:
data
id prod
1 1 eggs
2 2 fresh <br> turkey
3 3 meat tosón
Please, do you know what I am doing wrong?