[Rd] Build a R call at C level
j@goreck| @end|ng |rom w|t@edu@p|
Tue Jun 30 13:06:49 CEST 2020
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
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));
SEXP ans = PROTECT(eval(e, R_GlobalEnv));
On Tue, Jun 30, 2020 at 10:08 AM Morgan Morgan
<morgan.emailbox using gmail.com> wrote:
> 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]]
> R-devel using r-project.org mailing list
More information about the R-devel