Re: [Rpy] assignment to environments in rpy2

2009-02-03 Thread laurent
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

Re: [Rpy] [patch] numpy.asarray(SexpVector([...], LGLSXP)) fails

2009-02-03 Thread Nathaniel Smith
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

[Rpy] [patch] numpy.asarray(SexpVector([...], LGLSXP)) fails

2009-02-03 Thread Nathaniel Smith
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

[Rpy] assignment to environments in rpy2

2009-02-03 Thread Nathaniel Smith
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,

Re: [Rpy] rpy2, PyQt4 and Threading?

2009-02-03 Thread Laurent Gautier
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

[Rpy] rpy2, PyQt4 and Threading?

2009-02-03 Thread B Clowers
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