Displaying 2 results from an estimated 2 matches for "r_findnamespac".
Did you mean:
r_findnamespace
2010 Jan 14
1
how to call a function from C
Hi,
In Rcpp, we now have a "Function" class to encapsulate functions (they
cover all three kinds, but this may change).
To call the function, what we do is generate a call with the function as
the first node and then evaluate the call.
SEXP stats = PROTECT( R_FindNamespace( mkString( "stats") ) );
SEXP rnorm = PROTECT( findVarInFrame( stats, install( "rnorm") ) ) ;
SEXP call = PROTECT( LCONS( rnorm, CONS( ScalarInteger(10),
CONS(ScalarReal(0), R_NilValue ) ) ) );
SEXP res = PROTECT( eval( call , R_GlobalEnv ) );
UNPROTECT(4) ;
return res ;
It w...
2018 Dec 04
3
patch to support custom HTTP headers in download.file() and url()
...(Rconnection con)
#endif
case HTTPsh:
{
- SEXP sheaders, agentFun;
- const char *headers;
+ SEXP sagent, agentFun;
+ const char *agent;
SEXP s_makeUserAgent = install("makeUserAgent");
agentFun = PROTECT(lang1(s_makeUserAgent)); // defaults to ,TRUE
SEXP utilsNS = PROTECT(R_FindNamespace(mkString("utils")));
- sheaders = eval(agentFun, utilsNS);
+ struct urlconn *uc = con->private;
+ sagent = eval(agentFun, utilsNS);
UNPROTECT(1); /* utilsNS */
- PROTECT(sheaders);
- if(TYPEOF(sheaders) == NILSXP)
- headers = NULL;
+ PROTECT(sagent);
+ if(TYPEOF(sagent) == NILSXP...