RStudio R 文件损坏 [英] RStudio R File Corruption

查看:111
本文介绍了RStudio R 文件损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 RStudio 中打开了一个 R 脚本.该文件在几周内被多次保存,并且在打开和关闭 RStudio 时工作得非常好.然而,今天,我重新启动了我的电脑,当我打开 RStudio,更具体地说是我提到的脚本时,所有的 R 代码都消失了,只留下一长排带有红色突出显示的.....".

I had a R script open in RStudio. The file was saved many times over the course of several weeks and worked perfectly fine when RStudio was opened and closed. However, today, I restarted my computer and when I opened RStudio and more specifically the script that I mentioned, all of the R code vanished, leaving a single long row of "....." with red highlighting.

当我尝试在其他文本处理器(例如 Sublime Text 和 Notepad++)中打开 R 文件时,只能看到一行零.我的其他 R 文件都没有受到影响.我目前运行的是 Windows 8.1 并且拥有最新版本的 R 和 RStudio.我该怎么做才能恢复文件中的代码并防止类似的事情再次发生?

When I tried to open the R file in other text processors such as Sublime Text and Notepad++, only a line of zeroes was visible. None of my other R files were affected. I'm currently running Windows 8.1 and have the latest version of R and RStudio. What can I do to recover the code in the file and prevent something like this from happening again?

推荐答案

目前尚不清楚是什么损坏了您的文件(以及如何在可能的情况下修复它),而且您只看到其中的 0 有点不祥其他文本编辑器,但我会给你我最好的建议和一些提示.

It's not clear what happened to corrupt your file (and thus how to fix it if possible) and it is kind of ominous that you're just seeing 0's in other text editors, but I'll give you my best suggestion and some tips.

尝试恢复的建议

  1. 由于您的其他 R 文件未受影响,因此您的代码历史记录中应该有一段杂乱的记录.使用历史记录重建您的代码.

  1. Since your other R files were unaffected, you should have a messy record of your code in the history. Use the history to reconstruct your code.

从您可能使用过的任何版本控制、云或离线备份访问您的文件副本——git、SVN、iCloud、SugarSync、Dropbox 等(我意识到您可能不会发布这个质疑这是否是一种选择,但我不得不把它扔在那里).

Access a copy of your file from any version control, cloud, or offline backup you may have used -- git, SVN, iCloud, SugarSync, Dropbox, etc (I realize you probably wouldn't have posted this question if that were an option, but I had to throw it out there).

使用十六进制或扇区编辑器尝试恢复数据.

Use a Hex or sector editor to try to recover the data.

使用数据恢复程序查找文件的旧版本.

Use a data recover program to find an old version of your file.

检查您的垃圾箱或回收箱,看看它是否有旧版本.根据您的操作系统以及您如何(不安全或安全地)删除文件的设置,您也许可以取消删除已删除的版本,即使它不是立即可用的.

Inspect your trash or recycling bin to see if it has an old version. Depending on your OS and the settings of how you (insecurely or securely) delete files, then you may be able to undelete a deleted version, even if it's not immediately available.

尝试从损坏的文本文件中恢复文本数据的不同方法,例如 OpenOffice 的Microsoft的建议.

Try different methods of recovering text data from corrupted text files like OpenOffice's and Microsoft's suggestions.

未来提示

我知道事后诸葛亮是 20/20,但有几个快速提示可以很好地衡量:

I know that hindsight is 20/20, but a few quick tips for good measure:

  1. 使用版本控制.RStudio 的 GUI 界面支持 Git.

  1. Use version control. Git is supported in RStudio's GUI interface.

有多个版本的文件.许多教授和专业人士建议在文本编辑器中编写/存储代码,并将您的 IDE 仅用于工作副本.

Have more than one version of your file. Many professors and professionals recommend writing/storing code in a text editor and using your IDE only for the working copy.

进行备份.与 #2 不同的是,您应该将文件备份到硬盘、闪存驱动器或 Dropbox 或 Spideroak 等云服务.

Make backups. Distinct from #2, you should backup your files to a hard drive, flash drive, or cloud service like Dropbox or Spideroak.

这篇关于RStudio R 文件损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆