RStudio 在保存之前将临时 R 脚本文件存储在哪里? [英] Where does RStudio store the temporary R script files before saved?

查看:22
本文介绍了RStudio 在保存之前将临时 R 脚本文件存储在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚意外地让 RStudio 崩溃了,并且在重新启动时,与我所期望的相反,我一直在修补的 R 脚本无处可寻.

I've just had RStudio crash on me unexpectedly, and on re-starting, contrary to what I've come to expect, the R script I had been tinkering around with was nowhere to be found.

我已经设法找到了历史文件,因此我可以将所有命令拼凑起来,这令人放心.

I've managed to track down the Rhistory file so I'll be able to piece together all the commands, which is reassuring.

但是,我很好奇是否有什么地方我可以尝试寻找可能缓存在某处的临时未保存文件(毕竟,它通常> 缓存在 RStudio 显然知道要查看的地方).我应该搜索特定的文件扩展名/格式吗?

However, I am curious if there's somewhere I might try looking to find the temporary unsaved file on the off chance that might be cached somewhere (after all, it is usually cached somewhere that RStudio apparently knows to look). Is there a particular file extension/format I should be searching for?

目前在 Linux Mint 17.3(超过 Ubuntu 14.04.3 LTS)上运行 R 3.3.1 到 RStudio 0.99.903.

Currently running R 3.3.1 through RStudio 0.99.903 on Linux Mint 17.3 (over Ubuntu 14.04.3 LTS).

我尝试在命令行上运行 grep 以查找一些最近更新的代码行;我可能不走运.我找到了两个文件:

I've tried running grep on the command line to find some of the more recently updated lines of code; I may be out of luck. I found two files:

~/.rstudio-desktop/history_database

对于 RStudio 来说,这似乎基本上是一个更加集中的 .Rhistory

Which appears to basically be a more centralized .Rhistory for RStudio

~/.rstudio-desktop/sdb/s-9CD2C698/D7986B2A

这看起来像 JSON,而且似乎基本上是一个历史.如果我错了,请纠正我.

This looks JSON-like and also appears to basically be an Rhistory. Please correct me if I'm wrong.

推荐答案

正如来自 RStudio 的 @KevinUshey 所指出的:

As indicated by @KevinUshey from RStudio:

RStudio 将自动保存数据作为 JSON 'blob' 的一部分存储在 sdb 文件夹中.您应该看到文档被序列化为一个长字符串",并嵌入了换行符.

RStudio stores autosave data as part of the JSON 'blobs' within the sdb folder. You should see the document serialized as a long 'string', with newlines embedded.

使用诸如 jsonlite 之类的包来解析这个并祝你好运.

Use packages such as jsonlite to parse this and best of luck.

这篇关于RStudio 在保存之前将临时 R 脚本文件存储在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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