MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / convert_using_rfunction

Function convert_using_rfunction

inst/include/Rcpp/r_cast.h:29–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27 namespace internal {
28
29 inline SEXP convert_using_rfunction(SEXP x, const char* const fun) { // #nocov start
30 Armor<SEXP> res;
31 try{
32 SEXP funSym = Rf_install(fun);
33 Shield<SEXP> call(Rf_lang2(funSym, x));
34 res = Rcpp_fast_eval(call, R_GlobalEnv);
35 } catch( eval_error& e) {
36 const char* fmt = "Could not convert using R function: %s.";
37 throw not_compatible(fmt, fun);
38 }
39 return res; // #nocov end
40 }
41
42 // r_true_cast is only meant to be used when the target SEXP type
43 // is different from the SEXP type of x

Callers 6

set__Method · 0.85
r_true_cast<VECSXP>Function · 0.85
r_true_cast<EXPRSXP>Function · 0.85
r_true_cast<LISTSXP>Function · 0.85
r_true_cast<LANGSXP>Function · 0.85
Formula_ImplFunction · 0.85

Calls 1

Rcpp_fast_evalFunction · 0.85

Tested by

no test coverage detected