0

I'm working in R Studio and need to import a CSV dataset containing non English words (I'm using the import dataset GUI) but getting the following result: enter image description here

I tried all the available encodings in the locale configuration (including UTF-8) but without success.

mRiddle
  • 214
  • 1
  • 7
  • 22
  • Please give (in _text_ not an image) a small example of your data, maybe the first 4 lines of the first 4 columns, so that we can test solutions. – G5W Feb 25 '18 at 18:36
  • Sure, added a sample to my question under "Edit" – mRiddle Feb 25 '18 at 19:55
  • Hi, please better provide example data with `dput()` Thanks! *More:* [\[1\]](https://stackoverflow.com/a/28481250/6574038), [\[2\]](https://stackoverflow.com/a/10458688/6574038), [\[3\]](https://stackoverflow.com/help/mcve) – jay.sf Feb 25 '18 at 20:21

1 Answers1

0

Ok, after some trail and error I managed to find a solution that works:

Sys.setlocale("LC_ALL", "Hebrew")
library(readr)
zzt <- read_csv("D:/your_file_path/file_name.csv", locale = locale(date_names = "he", encoding = "UTF-8"))

The first line sets Hebrew as the local language.

The other two line are part of the dataset uploading process (save in the 'import' GUI), note the two additions inside the locale brackets.

Make sure the CSV file has 'UTF-8' encoding. If not, open it via Notepad and save again with this encoding in the CSV format.

mRiddle
  • 214
  • 1
  • 7
  • 22