Importing an Excel file with Greek characters into R in the correct encoding

感情迁移 提交于 2019-11-29 07:18:12

Try this:
Sys.setlocale(category = "LC_ALL", locale = "Greek")

Try this:

library(stringi)

?stringi

Apply this to see your file codification

stri_enc_detect("path-to-your-file/your-file.csv", filter_angle_brackets = T)

stri_enc_detect2("path-to-your-file/your-file.csv", locale = NULL)

The first one works for me.

Then apply the result in the read.csv(), as the example bellow:

    df <- read.csv("path-to-your-file/your-file.csv",header = TRUE, sep = ";", 
quote = "\"", na.strings = "", dec = ".", skip = 2, check.names = T, 
fileEncoding = "YOUR RESULT OF stri_enc_detect", encoding = "UTF-8")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!