本文介绍了R CMD检查和.RDa数据文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据子目录下有.RDa格式的数据文件.但是,R CMD check命令在此阶段无法识别load("test.RDa")命令及其失败,并给出以下错误:

I have data files in the .RDa format under the data sub directory. But, the R CMD check command is not recognizing the load("test.RDa") command and its failing at this stage and gives the following error:

Warning in readChar(con, 5L, useBytes = TRUE) :
cannot open compressed file 'test.RDa', probable reason 'No such file or directory'
Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
Calls: load -> readChar
Execution halted

您能告诉我原因吗?我应该提供一个指定从何处加载的路径吗?

Can you please let me know the reason? Should I give a path specifying from where to load?

推荐答案

如果要在包中包含数据,请将其放在mypkg/data/foo.rda中,然后通过data(foo)加载".您还应该创建一个mypkg/man/foo.Rd文件来记录数据.

If you want to include data in your package, put it in mypkg/data/foo.rda and "load" it via data(foo). You should also create a mypkg/man/foo.Rd file to document the data.

包中的数据部分中了解更多信息. 编写R扩展.

这篇关于R CMD检查和.RDa数据文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 14:10