.Rmd files open as completely empty

余生颓废 提交于 2021-01-26 22:34:10

问题


When opening .rmd files in RStudio 3.3.2, they show up as completely empty. There is text if I open using Notepad or if I open on another machine. What is going on?

RMD file in question


回答1:


I had a similar issue with older R files that opened as empty. It turned out that RStudio didn't use the correct encoding as default and therefore wasn't able to read the file (presented the file as empty).

You can make sure that you are using the correct encoding by:

  1. Opening the file in RStudio as you normally would (the file will be empty)
  2. Navigate to File -> Reopen with Encoding...
  3. Select UTF-8 and click OK

UTF-8 will most likely be the encoding you need. You can also choose to set this as the default for all source files.

This issue was also addressed on RStudio Support




回答2:


In RStudio go to:

  1. Tools
  2. Global Setting
  3. Left hand side "Code" a. under "Saving" - Default text econding: change to UTF-8



回答3:


save @Richard N mentioned, save the files with "UTF-8" encoding. Will solve the issue. Incase you saved the files without encoding, use the open with encoding option under "Files" tab.



来源:https://stackoverflow.com/questions/44298161/rmd-files-open-as-completely-empty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!