<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#3333FF">
<br>
<br>
On 06/26/2012 02:00 AM, Dirk Eddelbuettel wrote:
<blockquote cite="mid:20456.64426.9092.876041@max.nulle.part"
type="cite">
<pre wrap="">
Andy,
it seems you simply want a creator function in C++ which creates a
simulation object, which you then modify and alter in R, possibly give back
to C++ etc. Is that correct?
In the case, Rcpp can help easily. </pre>
</blockquote>
Andy,<br>
<br>
I second Dirk's answer, with the following addition. My "simulation
object" (SO) was a bit big, and I was loosing a lot of time to copy
operations (not sure if this is Rcpp's fault or my lack of coding
skill). My solution was to use classes. I code, in C++, my SO as a
class. I use the Rcpp class interface to write R wrappers to the
functions which manipulate the state of the SO. <br>
<br>
To run a simulation, I load the module into R, create an instance of
the class, then run the simulation via the R functions which are
linked to the SO functions.<br>
<br>
I am sure there is a more elegant way, but this approach works.<br>
<br>
+glenn<br>
<br>
<blockquote cite="mid:20456.64426.9092.876041@max.nulle.part"
type="cite">
</blockquote>
<br>
<pre class="moz-signature" cols="66">--
-----------------------------------
It is difficult to find a black cat in a dark room,
especially if there is no cat.
-- Chinese proverb
Dr. Glenn Lawyer
+352 661 967 244
Max-Planck-Institut für Informatik
Computational Biology and Applied Algorithmics
Campus E1 4
66123 Saarbrücken, Germany
<a class="moz-txt-link-freetext" href="http://bioinf.mpi-inf.mpg.de/~lawyer">http://bioinf.mpi-inf.mpg.de/~lawyer</a>
</pre>
</body>
</html>