Problem with accentuation - R

0

I try to solve the accent problem with this script:

Mapa@data$NAME_2 <- Mapa@data$NAME_2 %>% 
      as.character() %>% 
      stri_trans_general("Latin-ASCII") %>% 
      toupper()

But when I open the column NAME_2 , the name of the municipalities is, for example: MACEIA³ instead of MACEIÓ or MACEIO. Mapa@data$NAME_2 is a column with the name of the municipalities of Brazil.

    
asked by anonymous 12.06.2018 / 19:57

2 answers

0

Try this:

#Ajustando codificação de caracters do dataset
df = apply(Mapa@data, 2, as.character) 
Encoding(df) = "UTF-8"
Mapa@data = as.data.frame(df)
    
13.06.2018 / 06:18
0
# Instalar o pacote abjutils, se ainda não tiver instalado:
# install.packages("abjutils")

library(abjutils)
x <- c("maceió", "acentuação")
rm_accent(x)
#> [1] "maceio"     "acentuacao"

Created on 2018-06-27 by the [reprex package](http://reprex.tidyverse.org) (v0.2.0).

Or, this topic has other answers: Remove accents

    
28.06.2018 / 01:06