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

2009-02-08 Thread Laurent Gautier
Thanks for your patch. I had to replace in test_SexpVectorNumeric.py nx.typecode() by nx.dtype.kind I am not using numpy as much as as use other packages, but I think that typecode() was coming from Numeric and is disappearing. I am patching the tip, and will likely backport this to the branch

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