[Rd] Build a R call at C level

Morgan Morgan morg@n@em@||box @end|ng |rom gm@||@com
Tue Jun 30 11:08:10 CEST 2020

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

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));
return ans;



The above works. My question is how do I add the argument "na.rm=TRUE" at C
level to the above call? I have tried various things based on what is in
section 5.11 but I did not manage to get it to work.

Thank you
Best regards

	[[alternative HTML version deleted]]

More information about the R-devel mailing list