On Tue, 2009-02-03 at 13:30 -0800, Nathaniel Smith wrote:
> why does EnvironmentSexp_ass_subscript (==
> rpy2.rinterface.SexpEnvironment.__setitem__) copy the value it is
> storing?
>
> PROTECT(sexp_copy = Rf_duplicate(sexp));
> Rf_defineVar(sym, sexp_copy, rho_R);
That's from the early de
Patch.
diff -r 78fbb8a3131a rpy/rinterface/array.c
--- a/rpy/rinterface/array.c Mon Feb 02 21:14:18 2009 +0100
+++ b/rpy/rinterface/array.c Tue Feb 03 20:46:37 2009 -0800
@@ -36,7 +36,12 @@
//case STRSXP: return 'S';
//FIXME: handle 'O' (as R list ?)
case CPLXSXP: return 'c';
- case LGLS
Currently one cannot coerce R "logical" vectors to a numpy vector:
>>> import rpy2.rinterface as ri
>>> np.asarray(ri.SexpVector([True, False], ri.LGLSXP))
[...]
ValueError: unsupported typestring
The problem is that rpy2 is describing that SEXP as containing an
array of 32-bit (!) booleans. That
why does EnvironmentSexp_ass_subscript (==
rpy2.rinterface.SexpEnvironment.__setitem__) copy the value it is
storing?:
PROTECT(sexp_copy = Rf_duplicate(sexp));
Rf_defineVar(sym, sexp_copy, rho_R);
I noticed this because I was trying to get dim<- to work on an
SexpVector -- r["dim<-"](mysexp,
Currently, the evaluation of R functions do not release Python's GIL
(which is obviously a show-stopper when it comes to multithreading).
I had a quick try at releasing the GIL, but this is appeared to cause
significant(*) trouble when exceptions had to be raised. Having that
working is on the
I've managed to get a few functions from R working as I'd expect with rpy2,
however, I'm trying to move toward embedding some of these functions in a gui
using PyQt4. There is no specific reason for PyQt4 other than I'm somewhat
familiar with it. Anyway, I tried placing the rpy2 functions int