Dear All,
For the following C code:
 
SEXP testR(SEXP rho) {
            SEXP evalStr,evalRes;
            Char     cmdstr[1024];
            SEXP   val;
            
            /* Get the value of variable 'val' defined already in the R
environ */
            PROTECT(val = findVar(install("val"),rho));
 
            /* Execute the command : rn = rnorm(val) in R via eval */
            Sprintf(cmdstr,"%s%d%s","rn = rnorm(",asInteger(val),")");
            evalStr  = mkString(cmdstr);
            eval(evalStr,rho);
            
            UNPROTECT(1)
 
            Return(R_NilValue);
}
 
I am trying to call this testR function from R
(.Call("testR",globalenv()). I was hoping to see the object "rn" created
in the R environment however I cannot see the object being created. What
should be done to make the "rn" object visible in the R environment?  
 
TIA      
 
Manoj
 
 
 
            
 
 

	[[alternative HTML version deleted]]


