Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R write.csv not handling characters like é correctly

When I look at data in R, it has characters like "é" displayed correctly.

I export it to excel using write.csv. When I open the csv file, "é" is displayed as "√©". Is the problem with write.csv or with excel? What can I do to fix it?

Thanks

like image 263
carljong2019 Avatar asked Aug 26 '26 09:08

carljong2019


2 Answers

Try the write_excel_csv() function from the readr package

readr::write_excel_csv(your_dataframe, "file_path")
like image 75
wanderzen Avatar answered Aug 28 '26 06:08

wanderzen


It's a problem with Excel. Try Importing data instead of Opening the file.

Go to: 'Data' --> 'From Text/CSV' and then select '65001:Unicode (UTF-8)'. That will match the encoding from R.

enter image description here

enter image description here

like image 30
Wilfredo Avatar answered Aug 28 '26 07:08

Wilfredo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!