I want to print the C code of the bh
function in the R package frailtysurv
.
So I typed:
> 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>
With this warning at the top of the corresponding Github page:
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
But then I don't find a src file in the 'frailtySurv' library or another file where I could find the _frailtySurv_bh
function.
No trace of any .Rcpp
functions in the package source.
I know that similar questions were already asked few times (example: here, here or here among others) to print functions called by .Call
.
These were not helpful in my case.
Any tip on where can I find the _frailtySurv_bh
function?
Thanks :-)
The _frailtySurv_bh
function is defined in the RcppExports.cpp
file, which is defined here, and looks like this:
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
}
you will see it is actually a very thin wrapper for the C++ function called bh
which is a bit too long to reproduce here, but is defined here.