R: RStudio的中文读取、保存与显示
来源:互联网 发布:智能对话机器人软件 编辑:程序博客网 时间:2024/06/05 15:33
做中文文本挖掘的时候经常要读取中文网站上的信息,但英文系统RStudio在WINDOWS系统下有无法完全兼容中文字符,所以print到显示器上的中文字符统统是乱码。处理方法如下:
首先修改系统语言:
- Control Panel -> Region and Language -> Formats -> Chinese (Simplified, PRC)
- Control Panel -> Region and Language -> Administrative -> Change System Locale... -> Chinese (Simplified, PRC)
修改完了以后,可以用`sessionInfo()`在RStudio中查看系统设置:
sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936
[2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
[3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_People's Republic of China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lubridate_1.3.3 tmcn_0.1-3
loaded via a namespace (and not attached):
[1] bitops_1.0-6 digest_0.6.8 httr_0.6.1 memoise_0.2.1
[5] plyr_1.8.1 Rcpp_0.11.3 RCurl_1.95-4.5 Rwordseg_0.2-1
[9] stringr_0.6.2 swirl_2.2.21 testthat_0.9.1 tools_3.1.2
[13] yaml_2.1.13
可以看到
然后修改RStudio中的读取和保存,还有默认编辑的encoding设置——统统修改为UTF-8:- File -> Reopen with Encoding -> UTF-8
- File -> Save with Encoding -> UTF-8
- Tools -> Global -> General -> Default text encoding -> UTF-8
唯一的不太习惯的地方就是所有的error message或者warning message都会变得有点莫名其妙。。。
library(dfsaf)
Error in library(dfsaf) : 不存在叫‘dfsaf’这个名字的程辑包
如果没有心理洁癖,这样将就还是可以的。。。
0 0
- R: RStudio的中文读取、保存与显示
- R的安装与RStudio的安装
- 【R语言】【Rstudio】中文支持
- android中文件的保存与读取
- 图像的读取,显示与保存
- 01R与Rstudio的获取与安装
- 【R语言学习笔记】一、 数据的读取与保存
- R与Rstudio的安装和环境变量的配置
- wxpython无法保存和读取显示中文的解决
- R与RStudio安装与学习(一)
- VC/MFC中中文的保存与读取
- R语言笔记(一):R与Rstudio的安装(Windows)
- R语言-RStudio打开中文注释的脚本后出现乱码
- 【python图像处理】图像的读取、显示与保存
- 位图的读取、显示、保存
- R图片保存到PDF文件中顺利显示中文的方法
- R图片保存到PDF文件中顺利显示中文的方法
- R语言最好的IDE:Rstudio介绍
- LEETCODE: Maximum Product Subarray
- 当json对象的key为数字时,在js中读取value的方法
- easyUI,重新渲染
- java中判断字符串是否是一个整数(转载)
- eax, ebx, ecx, edx, esi, edi, ebp, esp等都是X86 汇编语言中CPU上的通用寄存器的名称
- R: RStudio的中文读取、保存与显示
- div页面居中
- Windows 下pip安装以及virtualenv环境搭建
- LeetCode--Excel Sheet Column Title
- 不恰当使用线程池处理 MQ 消息引起的故障
- c3p0连接池配置
- c#用npoi读取excel
- 【curl】error while loading shared libraries: libpcre.so.1
- 【整理】uclibc,eglibc,glibc之间的区别和联系