Skip to content
Prev 31140 / 63421 Next

Accessing a c-level complicated structure from R

Hi.

2009/1/22 Scionforbai <scionforbai at gmail.com>:
If you have to pass these data structures up to R you have to use the
.Call interface and wrap your C objects in an extern ptr R obj. That's
described in  "Writing R extensions".

Let me note you're undertaking a major work. If the software isn't
conceived as being used as a shared library, it can be much work to
translate it that way.
You can consider to use the external program as is, i.e. a stand-alone
program, and use temp text files for input-output. You can wrap it in
convenient R functions, and keep all that invisible to the end user.
This would require much less work... That's for instance how RTisean
and some BUGS related CRAN packages works, and I'm sure there are
others there.
Actually, R-exts has the info you need. Look at it more carefully. You
don't even need R-ints.

HTH,
a.f.