On May 10, 2013, at 5:34 AM, Matwey V. Kornilov wrote: > > Thanks, It is what I was looking for. But now, I poorly understand > environment conception. My initial C function in invoked from R (in some > environment I suppose), how do I know this env, to provide it to eval()? Or, > may I just make a clean env? >
It depends on where you want to evaluate it. R_GlobalEnv is the most common - mostly it acts as if you evaluated it on the console. If you want a particular namespace (e.g. myPackage), you can use R_FindNamespace(mkString("myPackage")) to find it. Cheers, Simon > > 10.05.2013 00:13, Gabriel Becker пишет: >> Matwey, >> >> There are a number of ways to do this, but it depends on what exactly you >> want. Do you want to execute a call to an actual R function from within C, >> or do you want to directly call one of R's internal C functions (which may >> work but is not future-safe unless it is part of the official API). >> >> If its the first, see Martin Morgan's post here: >> http://stackoverflow.com/questions/7457635/calling-r-function-from-c for >> more detail about the approach I believe Simon is referring to. As for the >> second, they are normal C functions, but I believe the consensus is that if >> they aren't part of the API you are on your own figuring out how they work >> (the source code is available for this of course). >> >> Hope that helps, >> ~G > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel