The function exposeClass() has been added to Rcpp. The idea is to call it to
create C++ and R files in a package source in order to export a C++ class,
given basic information about the class.
The function writes the Module source in C++ and a corresponding call to
setRcppClass in R.
Like com
ns ptr.
I can say from experience that this all gets rather complicated.
However I haven't looked at John Chambers' new code for Rcpp classes
in R and he might have addressed the issue.
Well, no, and it doesn't seem particularly a modules issue, but rather a
general point in u
The two limitations mentioned below, export patterns and loading warning
from CMD check, should have been fixed in the current versions of
r-devel and 2.15 patched. The "global variables" note remains, but it's
been remarked often in other contexts as well.
John
On 4/20/1
As of a recent version of Rcpp on r-forge (rev. 3582 or later), there is
a new facility for defining an R class extending a C++ class extracted
from a module.
The main tool is setRcppClass in package Rcpp. See its documentation.
Also in the unittests directory of package Rcpp is an example p
At the risk of derailing this thread into the quicksand of programming
style
Except when required by the specific application, my preference would be
to stay with the Rcpp idiom. Mixing in the older C API seems to risk
more programming error. Of course, each application is different and
Sorry, didn't see this before my last mail. Looks like a better solution.
On 12/2/10 1:55 PM, Romain Francois wrote:
Le 02/12/10 22:51, Romain Francois a écrit :
Le 02/12/10 22:40, Douglas Bates a écrit :
I currently use constructions like
if (as(lst.attr("class")) != "family")
throw std::ru
There is a related routine in R_HOME/src/main/attrib.c:
EXP R_data_class(SEXP obj, Rboolean singleString)
{
SEXP value, klass = getAttrib(obj, R_ClassSymbol);
int n = length(klass);
if(n == 1 || (n > 0 && !singleString))
return(klass);
if(n == 0) {
SEXP dim = getAttrib(obj
Romain's solution is almost certainly the way to go.
Just for completeness, note that you can define a field on the R side to
be an accessor function as well, using the standard mechanism for active
bindings; i.e., an R function (anonymous if you want) that returns the
field if called without
There was a problem in that creating a subclass in R of an Rcpp class
attempts to call a default constructor.
I have code that fixed the problem, by creating a suitable $initialize()
method based on the existence or not of the default C++ constructor, but
unfortunately I have yet to fully test
On 11/1/10 12:28 PM, Douglas Bates wrote:
I should probably ask this question on R-devel as it is not directly
an Rcpp question but the thread started here so ...
I'm confused about accessor functions as described in
help("setRefClass") under the argument "fields". It states
The e
10 matches
Mail list logo