【问题标题】:Roxygen2 says Error: file already exists .../RcppExports.cppRoxygen2 说错误:文件已经存在 .../RcppExports.cpp
【发布时间】:2014-06-29 22:13:48
【问题描述】:

我正在练习使用 Rcpp、devtools 和 roxygen2 编写 R 包。但是,当我在 dev 模式下运行 document("mypkg") 时,出现以下错误:

Updating mypkg documentation
Loading mypkg
Error: file already exists: 'mypkg/src/RcppExports.cpp'

我的 RcppExports.cpp 文件与默认的 Rcpp.package.skeleton 非常相似。

这里可能出了什么问题?

我知道我可能应该提供更多相关信息,但我真的不知道。如果有人有任何建议,我很乐意在这里提供更多信息。

最好的问候,

【问题讨论】:

    标签: r rcpp devtools dplyr roxygen2


    【解决方案1】:

    消息file already exists来自this line in Rcpp

    isSafeToOverwrite 看起来像这样:

        // Check whether it's safe to overwrite this file (i.e. whether we
        // generated the file in the first place)
        bool isSafeToOverwrite() const {
            return existingCode_.empty() ||
                   (existingCode_.find(generatorToken()) != std::string::npos);
        }
    

    所以我最好的猜测是compileAttributes 放在文件顶部的生成器令牌发生了一些事情。

    【讨论】:

      【解决方案2】:

      嗯,“对我有用”,但我不使用开发工具。

      我愿意

      • 从一个新的包开始,看看它是否/哪里坏了

      • 确保您没有被 roxygen2 4.0 之前/之后的问题所困扰(有转换器脚本)

      • 也许可以尝试使用/不使用 devtools -- 我很乐意在 RStudio 中使用 roxygen2 和 Rcpp 的当前(非公共)包中的构建和重新加载

      【讨论】:

      • 天真的 Rcpp 骨架包有效。我将进一步调查并更新这篇文章。谢谢
      猜你喜欢
      • 2018-02-28
      • 2015-07-23
      • 2015-12-17
      • 2023-03-07
      • 1970-01-01
      • 1970-01-01
      • 2021-10-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多