[Rd] using openbabel plugins in R

Dirk Eddelbuettel edd at debian.org
Tue Mar 26 14:54:55 CET 2013


On 25 March 2013 at 12:50, Kevin Horan wrote:
| I posted this in openbabel-devel but didn't get much help, so hopefully 
| someone here can help. I don't think its too openbabel specific.
| 
| I would like to make use of open babel from within the R language.
| Initially I just need to do some format conversions, but may expand the
| usage to other parts of OpenBabel as well. I am familiar with embedding
| C/C++ code in R, but I'm having some trouble with the plugin mechanism
| of OpenBabel in this case. The  problem is that the formats are not
| available when I run the OpenBabel code from within R. So, for example,
| if I search for the SDF format like so:
|       OBFormat *format = conv.FindFormat("SDF");

[...]

|      The way it works normally in OpenBabel is that each plugin is its 
| own shared library and then they get loaded at run time with the dlopen 
| function (on linux at least). I have verified that this code is still 
| being executed when called from within R, but it doesn't work for some 
| reason.

I would try to start from the smallest possible working examples.  R itself
uses dlopen (see eg $RHOME/modules/ for the files it loads), and so does
OpenBabel. Maybe some wires get crossed. You may well have to dig down with
the debugger and see what assumptions / environment variables / ... are valid
or invalid between the working and non-working case.

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com



More information about the R-devel mailing list