R中的非英语字符

时间:2015-10-13 05:00:25

标签: r encoding utf-8 read.table read.csv

我有一个非英文字符的文件。

问题在于我正在使用R-studio并尝试了我所知道的所有非英文字符,但我看到的只是垃圾。

> Sys.setlocale("LC_CTYPE", locale="Chinese")

[1] "Chinese (Simplified)_People's Republic of China.936"

> sessionInfo()

R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252                        LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
[3] LC_MONETARY=English_United States.1252                       LC_NUMERIC=C                                                
[5] LC_TIME=English_United States.1252                          

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.2.0



a<-'黑龙江省'
> a
[1] "ºÚÁú½­Ê¡"


> x=c('中華民族');x; y <- data.frame(x, stringsAsFactors=FALSE) 
[1] "ÖÐÈAÃñ×å"
> y
         x
1 ÖÐÈAÃñ×å
> q<-'天'

我也尝试过使用

> temp1<-read.table(file.choose(),header=FALSE,fill=TRUE,encoding="UTF-8",stringsAsFactors = FALSE)

和其他read.csv和read.table选项但无济于事。如果有帮助,我正在使用R-studio。

0 个答案:

没有答案