1

I have a problem with a file that I have generated in R using "write.csv".

When I try to import it in Excel, I have some "weird characters". And finally I can't open it.

Here my code for the write.csv:

write.csv(all_sdoub,file="all_new.csv",fileEncoding = "UTF-8")

I have tried with fileEncoding ASCII, or without file encoding, I always have the same problem. I tried to send the file to a colleague, she has the same problem.

I work on a R session on a linux server. Any idea of what is happening?

edit: I have tried to had this line:

options(encoding = "UTF-8")

But it doesn't change anything to the problem.

Oolis
  • 146
  • 2
  • 2
  • 13

2 Answers2

0

As it is noted at a similar question you need to import CSV file to Excel.

You can do this under Data tab using the "From text" button where you are able specify the encoding, delimiters and so on.

zankuralt
  • 173
  • 2
  • 9
  • The problem happens when I import the file in Excel. I see the weird characters in the "preview". – Oolis Jun 13 '17 at 13:43
  • @Oolis can you check the file in Notepad++ so see which encoding is being actually used. – zankuralt Jun 13 '17 at 13:50
  • I don't know what encoding it is. Here a sample of what I can see in Notepad++:RDX2 X to_save c jÔ 2G 2G 2G 2G 2G 2G 2G 2G 2G 2G 2G 2G 2G – Oolis Jun 13 '17 at 13:59
  • And after: §S.@FzáG®@Gù´è<.@Ft2í×á@Gõ¹u0àq@EÆ“é>š@E¡™™™™š@FyPÈ?Ãf@Fjó| ©@E™‡eC@EÐ£× =q@G¾F„³@H%0ì¨|@HFж¤@HE'Ò}4 (there's also some sorts of squares, but I can't display them on Stackoverflow) – Oolis Jun 13 '17 at 14:03
  • @Oolis check the **encoding tab** in notepad++ to see the file encoding. Are symbols displayed correctly in notepad++? – zankuralt Jun 13 '17 at 14:19
  • Hello, no, I have the same problem in Notepad++. I have tried all the encoding, I always have the weird characters. – Oolis Jun 14 '17 at 07:10
  • Hm, I it hard to help without the [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – zankuralt Jun 14 '17 at 13:09
  • for information things are better now that Ftcix has been added to the server! – Oolis Jun 20 '17 at 14:23
0

I had a similar problem and solved it through changing the file name I was using to store the csv.

hello_friend
  • 5,682
  • 1
  • 11
  • 15