【问题标题】:Rcpp share same roxygen between two functionsRcpp 在两个函数之间共享相同的 roxygen
【发布时间】:2019-10-08 21:16:56
【问题描述】:

考虑以下函数:

//' Provides some stuff AB
//' @param a integer that responsible for stuff A
//' @param b integer that responsible for stuff B
//' @export
// [[Rcpp::export]]
NumericVector foo1(int a, int b)
{
   //some code
}

//' Provides some stuff AC
//' @param a integer that responsible for stuff A
//' @param c integer that responsible for stuff C
//' @export
// [[Rcpp::export]]
NumericVector foo2(int a, int c)
{
   //some code
}

请注意,参数 a 对 foo1 和 foo2 的描述应该相同。我有许多功能,应该以相同的方式提供 a 参数描述。我不想在每次单独为每个函数需要它时复制过去 a 参数的描述。是否可以指定 a 描述并将其应用于我的 Rcpp 包提供的所有功能?

将非常感谢您的帮助!

【问题讨论】:

  • 我认为这完全是一个roxygen2 而不是Rcpp 的问题,是的,我想我已经看到它被使用过——也许@rdname 就是你要找的全部?跨度>

标签: r rcpp roxygen2 roxygen rcpp11


【解决方案1】:

感谢 Dirk Eddelbuettel,我找到了答案:

//' @name sharable
//' @rdname sharable
//' @param a integer that responsible for stuff A
//' @export

//' Provides some stuff AB
//' @rdname sharable
//' @param b integer that responsible for stuff B
//' @export
// [[Rcpp::export]]
NumericVector foo1(int a, int b)
{
   //some code
}

//' Provides some stuff AC
//' @rdname sharable
//' @param c integer that responsible for stuff C
//' @export
// [[Rcpp::export]]
NumericVector foo2(int a, int c)
{
   //some code
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-29
    • 2013-07-25
    • 1970-01-01
    • 2021-05-01
    • 2019-02-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多