使用 roxygen2 记录 Rcpp 模块暴露的方法

Documenting Rcpp module exposed methods with roxygen2

我的包中有一个 Rcpp 模块,它除了公开 class 外,还公开了许多方法。是否可以使用 roxygen2 记录这些方法(在 C++ 方面)?我的模块如下所示:

RCPP_MODULE(BayesFst) {
using namespace Rcpp;

class_<BayesFst>( "BayesFst")
.default_constructor("Standard constructor")
.method("printData", &BayesFst::printData)
.method("printCounts", &BayesFst::printCounts)
.method("printInitialPvals", &BayesFst::printInitialPvals)
.method("printFstSummary", &BayesFst::printFstSummary)
.method("run", &BayesFst::run)
.method("setData", &BayesFst::setData)
.method("setPriorParameters", &BayesFst::setPriorParameters)
.method("setRunParameters", &BayesFst::setRunParameters)
.method("ldiriTest", &BayesFst::ldiriTest)
.property("interaction", &BayesFst::getInteraction, &BayesFst::setInteraction)
;

}

我想理想地记录所有这些方法。一个简单的想法是将 class 隐藏在包装函数后面,然后从 R 包装函数中调用方法,但这对我来说有点不雅。

我已经尝试将 roxygen 注释行添加到函数中,但是因为它们没有以相同的方式导出,所以文档似乎没有被提取。

您将无法依靠 Rcpp 以 compileAttributes() 的方式携带 roxygen 文档...因为您没有调用 compileAttributes().

随意构建(并测试然后贡献 :) 一个新的辅助函数;否则我会在 R 文件中使用 roxygen 然后从那里继续。

编辑:我也filed an issue以免我们忘记它。