在 R 包中查找 Rcpp 函数
Find Rcpp function in a R package
我想打印R包frailtysurv
中bh
函数的C代码。
所以我输入:
> frailtySurv:::bh
function (d_, R_star, K_, Y_, N_, N_dot, beta, theta, frailty,
weights, abstol, reltol, maxit)
{
.Call("_frailtySurv_bh", PACKAGE = "frailtySurv",
d_, R_star, K_, Y_, N_, N_dot, beta, theta, frailty,
weights, abstol, reltol, maxit)
}
<bytecode: 0x0000025263262be0>
<environment: namespace:frailtySurv>
相应 Github 页面顶部出现此警告:
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
但后来我在 'frailtySurv' 库中找不到 src 文件,也没有在其他文件中找到 _frailtySurv_bh
函数。
包源中没有任何 .Rcpp
函数的踪迹。
我知道类似的问题已经被问过几次(例如:here, here or here 等)来打印 .Call
调用的函数。
这些对我的情况没有帮助。
关于在哪里可以找到 _frailtySurv_bh
函数的提示?
谢谢 :-)
_frailtySurv_bh
函数在 RcppExports.cpp
文件中定义,定义为 here,如下所示:
RcppExport SEXP _frailtySurv_bh(SEXP d_SEXP, SEXP R_starSEXP, SEXP K_SEXP, SEXP Y_SEXP, SEXP N_SEXP, SEXP N_dotSEXP, SEXP betaSEXP, SEXP thetaSEXP, SEXP frailtySEXP, SEXP weightsSEXP, SEXP abstolSEXP, SEXP reltolSEXP, SEXP maxitSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< NumericVector >::type d_(d_SEXP);
Rcpp::traits::input_parameter< List >::type R_star(R_starSEXP);
Rcpp::traits::input_parameter< List >::type K_(K_SEXP);
Rcpp::traits::input_parameter< List >::type Y_(Y_SEXP);
Rcpp::traits::input_parameter< List >::type N_(N_SEXP);
Rcpp::traits::input_parameter< List >::type N_dot(N_dotSEXP);
Rcpp::traits::input_parameter< NumericVector >::type beta(betaSEXP);
Rcpp::traits::input_parameter< NumericVector >::type theta(thetaSEXP);
Rcpp::traits::input_parameter< String >::type frailty(frailtySEXP);
Rcpp::traits::input_parameter< NumericVector >::type weights(weightsSEXP);
Rcpp::traits::input_parameter< double >::type abstol(abstolSEXP);
Rcpp::traits::input_parameter< double >::type reltol(reltolSEXP);
Rcpp::traits::input_parameter< int >::type maxit(maxitSEXP);
rcpp_result_gen = Rcpp::wrap(bh(d_, R_star, K_, Y_, N_, N_dot, beta, theta, frailty, weights, abstol, reltol, maxit));
return rcpp_result_gen;
END_RCPP
}
您会看到它实际上是一个名为 bh
的 C++ 函数的非常薄的包装器,它有点太长而无法在此处重现,但被定义为 here.
我想打印R包frailtysurv
中bh
函数的C代码。
所以我输入:
> frailtySurv:::bh
function (d_, R_star, K_, Y_, N_, N_dot, beta, theta, frailty,
weights, abstol, reltol, maxit)
{
.Call("_frailtySurv_bh", PACKAGE = "frailtySurv",
d_, R_star, K_, Y_, N_, N_dot, beta, theta, frailty,
weights, abstol, reltol, maxit)
}
<bytecode: 0x0000025263262be0>
<environment: namespace:frailtySurv>
相应 Github 页面顶部出现此警告:
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
但后来我在 'frailtySurv' 库中找不到 src 文件,也没有在其他文件中找到 _frailtySurv_bh
函数。
包源中没有任何 .Rcpp
函数的踪迹。
我知道类似的问题已经被问过几次(例如:here, here or here 等)来打印 .Call
调用的函数。
这些对我的情况没有帮助。
关于在哪里可以找到 _frailtySurv_bh
函数的提示?
谢谢 :-)
_frailtySurv_bh
函数在 RcppExports.cpp
文件中定义,定义为 here,如下所示:
RcppExport SEXP _frailtySurv_bh(SEXP d_SEXP, SEXP R_starSEXP, SEXP K_SEXP, SEXP Y_SEXP, SEXP N_SEXP, SEXP N_dotSEXP, SEXP betaSEXP, SEXP thetaSEXP, SEXP frailtySEXP, SEXP weightsSEXP, SEXP abstolSEXP, SEXP reltolSEXP, SEXP maxitSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< NumericVector >::type d_(d_SEXP);
Rcpp::traits::input_parameter< List >::type R_star(R_starSEXP);
Rcpp::traits::input_parameter< List >::type K_(K_SEXP);
Rcpp::traits::input_parameter< List >::type Y_(Y_SEXP);
Rcpp::traits::input_parameter< List >::type N_(N_SEXP);
Rcpp::traits::input_parameter< List >::type N_dot(N_dotSEXP);
Rcpp::traits::input_parameter< NumericVector >::type beta(betaSEXP);
Rcpp::traits::input_parameter< NumericVector >::type theta(thetaSEXP);
Rcpp::traits::input_parameter< String >::type frailty(frailtySEXP);
Rcpp::traits::input_parameter< NumericVector >::type weights(weightsSEXP);
Rcpp::traits::input_parameter< double >::type abstol(abstolSEXP);
Rcpp::traits::input_parameter< double >::type reltol(reltolSEXP);
Rcpp::traits::input_parameter< int >::type maxit(maxitSEXP);
rcpp_result_gen = Rcpp::wrap(bh(d_, R_star, K_, Y_, N_, N_dot, beta, theta, frailty, weights, abstol, reltol, maxit));
return rcpp_result_gen;
END_RCPP
}
您会看到它实际上是一个名为 bh
的 C++ 函数的非常薄的包装器,它有点太长而无法在此处重现,但被定义为 here.