Reputation: 2608
I'm working with a messy database, in which I need to give format to some columns of data. For this, I use a lot of GSub and other forms of regular expressions. My problem is some of the characters I need to clean are "weird" characters, specially the A with the curly thing above followed by other weird character (Ñ).
When I copy from the database and then paste on my gsub function:
gsub("CALLÑE", "CALLE", data)
It works fine until I close and RStudio and reopen it. Then the characters are different in the RScript file. It is as if RStudio didn't support weird characters itself, and removes them from the Scripts when they are reopened:
gsub("CALLÃ'E", "CALLE", data)
How can I avoid this? And keep my weird characters even after closing the file.
Upvotes: 0
Views: 821
Reputation: 1360
In RStudio, go to File
-> Save with Encoding...
Select UTF-8
option.
Upvotes: 2