how to remove the tildes and change the ñ of a dataframe

how to remove the tildes and change the ñ of a dataframe

I have a data frame and I transform it from lowercase to uppercase but I need to remove all the tildes and change the letter ñ to another letter if you could help me
This is the code of the transformation to capital letters

mutate_if(archivo18(), is.character, toupper)

You can write a function to do both actions.

library(dplyr)
DF <- data.frame(Word = c("piñon", "car", "niña", "bus"), Number = 1:4, 
                 stringsAsFactors = FALSE)
ChgLetter <- function(x) {
  x <- stringr::str_replace_all(x, "ñ", "n")
  x <- toupper(x)
  x
}
DF <- mutate_if(DF, is.character, ChgLetter)
DF

   Word Number
1 PINON      1
2   CAR      2
3  NINA      3
4   BUS      4
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.