rstudio怎么打开保存的文件_在RStudio中生成并重新加载会生成“保存文件”错误...

在使用RStudio(版本1.0.136,Ubuntu 16.04 64位)构建和重新加载Rcpp包时,用户遇到了"保存文件:没有这样的文件或目录"的错误。该错误在编辑文件时随机出现,导致无法保存。解决方案是关闭.RStudio.user子目录,这将删除所有未保存的数据,包括环境内容和未保存文件。建议在执行此操作前复制未保存文件的内容。
摘要由CSDN通过智能技术生成

I'm working on an Rcpp-enabled R package as a project in RStudio (version 1.0.136, Ubuntu 16.04 64 bit), and have recently started getting an error after building the package with Tools > Build and Reload. The error dialogue box reads:

Save File

No such file or directory

The error doesn't appear straight after building and reloading. Rather, it occurs some time later while making edits to files, seemingly at random, and not necessarily while trying to save. However, after closing the dialogue box files cannot be saved without generating another error, this time with the message:

Error Saving File

No such file or directory

Following that, the only way forward is to restart RStudio without saving any files, thus losing all changes.

It doesn't seem to be a problem with either roxygen2 or devtools since I've tried building with and without the Generate documentation with Roxygen and Use devtools package functions options in Tools > Project Options > Build Tools. I've also tried uninstalling andreinstalling RStudio as well as updating devtools etc, but the problem persists. I'm wondering if it's an issue in one of the package files such as NAMESPACE or DESCRIPTION. The package repository is available at https://github.com/shaunpwilkinson/insect.

解决方案

I ran into this error myself, and I'm posting what seems to have worked based on the comment from Shaun and a post on the RStudio support website.

The error is not limited to building a package; I encountered it while working in a bog standard RStudio project.

I found this comment from RStudio support here:

I think that if you clear the sdb (source data based) directory inside ~/.rstudio, then this might get things working for now.

So I closed RStudio, went into the terminal and removed the entire subdirectory .RStudio.user (inside the project directory, which is not what the comment above suggested directly). I restarted RStudio and voila. It works, and RStudio recreated the .RStudio.user directory.

WARNING: this will delete all the unsaved data including the contents of your environment and any unsaved files. You should copy the contents of unsaved files to another text editor before using this fix.

For future reference I am using RStudio 1.0.143 on OS/X 10.12.5.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
RStudio,你可以使用各种方法和包来生成模拟数据。以下是几种常用的方法: 1. 使用内置的函数:R语言提供了一些内置函数来生成随机数和随机变量。例如,你可以使用`rnorm()`函数生成符合正态分布的随机数,使用`runif()`函数生成在指定范围内均匀分布的随机数,使用`sample()`函数从给定的向量随机抽样等。 2. 使用专用的包:R社区开发了许多用于生成模拟数据的包,例如faker、simstudy、synthpop等。这些包提供了各种生成模拟数据的函数和方法,可以根据特定的需求生成符合特定分布、关系或模式的数据。 3. 自定义函数:如果你需要生成特定类型的模拟数据,可以编写自定义函数来实现。例如,你可以根据某些模型或规则生成模拟数据,或者根据特定的关系生成多个变量之间的数据。 以下是一个示例代码,演示如何使用内置函数和faker包生成一个简单的模拟数据集: ```R # 安装并加载faker包 install.packages("faker") library(faker) # 生成模拟数据 data <- data.frame( name = faker::name(), age = sample(18:60, 100, replace = TRUE), income = rnorm(100, mean = 50000, sd = 10000) ) # 查看生成的数据集 head(data) ``` 在这个示例,我们使用faker包生成了姓名,使用`sample()`函数生成了年龄(从18到60岁之间的随机整数),使用`rnorm()`函数生成了收入(符合均值为50000,标准差为10000的正态分布)。 你可以根据具体需求调整代码来生成不同类型的模拟数据。希望这个示例能对你有所帮助!如果你有任何其他问题,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值