I wasn't able to find documentation for this. It looks like the R source code uses NewEnvironment
and R_NewHashedEnv
, but neither of those are in the public headers, so it looks like they aren't available for me as a user. What function (or what lines of code) should I be using to generate a new ENVSXP?
You want allocSExp
:
/* C code in foo.c */
#include "Rinternals.h"
SEXP foo() {
SEXP res = allocSExp(ENVSXP);
return res;
}
> # R code (after running R CMD SHLIB foo.c)
> dyn.load("foo.dll")
> .Call("foo")
<environment: 0x016a4084>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With