[Rcpp-devel] today's commits overview

Romain François francoisromain at free.fr
Thu Jan 7 19:54:13 CET 2010


Today has been a Rcpp commit day :-)

We now have classes for most of the SEXP types:

SYMSXP 		Symbol
LISTSXP 	Pairlist
CLOSXP 		Function
ENVSXP 		Environment
PROMSXP 	Promise
LANGSXP 	Language
SPECIALSXP 	Function
BUILTINSXP 	Function
LGLSXP 		LogicalVector
INTSXP 		IntegerVector
REALSXP 	NumericVector
CPLXSXP 	ComplexVector
STRSXP 		CharacterVector
VECSXP 		GenericVector a.k.a List
EXPRSXP 	ExpressionVector
EXTPTRSXP 	XPtr
WEAKREFSXP 	WeakReference
RAWSXP 		RawVector

I have also added methods to deal with S4 objects (in the RObject class 
since an S4 object can be of any SEXP type): hasSlot, isS4 and slot.


For GenericVector and CharacterVector, I have implemented the proxy 
pattern as described in item 30 of More Effective C++, so that we can do :

CharacterVector x(10) ; /* create a character vector of 10 strings */
x[0] ; /* gets the first element */
x[1] = "foo" ; /* sets the second element */

List y(3) ;
y[0] = 1 ; /* 1 gets wrap()'ed into a IntegerVector */
y[1] = "foo" ; /* foo gets wrap()'ed into a CharacterVector */
y[2] = false ; /* false gets wrap()'ed into a LogicalVector */

As usual, many examples have been added in the unit tests.

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/JFqa : R Journal, Volume 1/2, December 2009
|- http://tr.im/IW9B : C++ exceptions at the R level
`- http://tr.im/IlMh : CPP package: exposing C++ objects



More information about the Rcpp-devel mailing list