【问题标题】:Configure R to use utf-8 by default将 R 配置为默认使用 utf-8
【发布时间】:2021-05-18 18:02:34
【问题描述】:

为避免在使用 R 和 RStudio 时出现问题,可以将 R 配置为默认使用 utf-8 吗?我的系统是 windows 10 64 位,R 脚本保存为 ANSI,但是当使用 RStudio 打开这些相同的文件时,拉丁字符、ñ、波浪号、欧元符号 € 存在问题。我必须转换文件以更改字符编码,以便可以将它们与 RStudio 一起使用。

从 R 控制台:


> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=Spanish_Spain.1252  LC_CTYPE=Spanish_Spain.1252   
[3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C                  
[5] LC_TIME=Spanish_Spain.1252    

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

loaded via a namespace (and not attached):
[1] compiler_4.0.5

【问题讨论】:

    标签: r


    【解决方案1】:

    在 RStudio 中转到工具栏,然后单击全局选项(在底部):

    见下图:点击代码,然后保存 -> 可以设置默认文本编码

    【讨论】:

    • 我已经更改了 RStudio 中的设置。
    • 在 R RGui 中,有可能吗?
    猜你喜欢
    • 2012-03-10
    • 2012-02-01
    • 1970-01-01
    • 2014-01-01
    • 2014-03-22
    • 1970-01-01
    • 1970-01-01
    • 2012-07-08
    • 1970-01-01
    相关资源
    最近更新 更多