search for: call_to_sum

Displaying 4 results from an estimated 4 matches for "call_to_sum".

2020 Jun 30
2
Build a R call at C level
Hi All, I was reading the R extension manual section 5.11 ( Evaluating R expression from C) and I tried to build a simple call to the sum function. Please see below. call_to_sum <- inline::cfunction( language = "C", sig = c(x = "SEXP"), body = " SEXP e = PROTECT(lang2(install(\"sum\"), x)); SEXP ans = PROTECT(eval(e, R_GlobalEnv)); UNPROTECT(2); return ans; ") call_to_sum(1:3) The above works. My question is how do I add t...
2020 Jun 30
3
Build a R call at C level
...n on R C api could be improved... Please see "5.11 Evaluating R expressions from C" from "Writing R Extensions" Best Tomas > Still R-package-devel mailing list should be preferred for this kind > of questions. > Not sure if that is the best way, but works. > > call_to_sum <- inline::cfunction( > language = "C", > sig = c(x = "SEXP"), body = " > > SEXP e = PROTECT(lang2(install(\"sum\"), x)); > SEXP r_true = PROTECT(CONS(ScalarLogical(1), R_NilValue)); > SETCDR(CDR(e), r_true); > SET_TAG(CDDR(e), instal...
2020 Jun 30
0
Build a R call at C level
It is quite known that R documentation on R C api could be improved... Still R-package-devel mailing list should be preferred for this kind of questions. Not sure if that is the best way, but works. call_to_sum <- inline::cfunction( language = "C", sig = c(x = "SEXP"), body = " SEXP e = PROTECT(lang2(install(\"sum\"), x)); SEXP r_true = PROTECT(CONS(ScalarLogical(1), R_NilValue)); SETCDR(CDR(e), r_true); SET_TAG(CDDR(e), install(\"na.rm\")); Rf_PrintVal...
2020 Jun 30
0
Build a R call at C level
...quot;5.11 Evaluating R expressions from C" from "Writing R > Extensions" > > Best > Tomas > > > Still R-package-devel mailing list should be preferred for this kind > > of questions. > > Not sure if that is the best way, but works. > > > > call_to_sum <- inline::cfunction( > > language = "C", > > sig = c(x = "SEXP"), body = " > > > > SEXP e = PROTECT(lang2(install(\"sum\"), x)); > > SEXP r_true = PROTECT(CONS(ScalarLogical(1), R_NilValue)); > > SETCDR(CDR(e), r_true)...