Re: [Rpy] RS4Auto_Type example throws an exception

2011-11-25 Thread Luca Beltrame
In data venerdì 25 novembre 2011 07:14:56, Laurent Gautier ha scritto:

> So it does work with R-2.14, Python 2.7, rpy2-2.2.4

Weird. For reference, I have python 2.7 (distro-supplied), R 2.14 (packaged,
but self compiled) and rpy 2.2.4 (self compiled).

I'll try installing rpy in a virtualenv (checking both the 2.2 and the
unstable version) to see if I can replicate the issue. If I do, I'll start
debugging the loop that collects the method names to see why it's  generating
an empty vector.

--
Luca Beltrame, Ph.D. - Translational Genomics Unit
Oncology Department, Mario Negri Institute


signature.asc
Description: This is a digitally signed message part.
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] From matrices to data.frames and vice versa

2011-11-25 Thread Luca Beltrame
In data venerdì 25 novembre 2011 07:18:24, Laurent Gautier ha scritto:

> The "Python way" might be to add a switch in the constructors of the
> relevant classes (rpy2.robjects.vectors.Matrix and
> rpy2.robjects.vectors.DataFrame).

I was thinking of something like (for DataFrame):

def __init__(self, tlist=None, matrix=None):

then going on. If this is a sensible design, I can try cooking up something
and doing a pull request on bitbucket later on.

--
Luca Beltrame, Ph.D. - Translational Genomics Unit
Oncology Department, Mario Negri Institute


signature.asc
Description: This is a digitally signed message part.
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] RS4Auto_Type example throws an exception

2011-11-25 Thread Luca Beltrame
In data venerdì 25 novembre 2011 09:59:13, Luca Beltrame ha scritto:

> Weird. For reference, I have python 2.7 (distro-supplied), R 2.14 (packaged,
> but self compiled) and rpy 2.2.4 (self compiled).

I'm happy to report that it was a local installation issue: recompiling rpy2
fixed it.

--
Luca Beltrame, Ph.D. - Translational Genomics Unit
Oncology Department, Mario Negri Institute


signature.asc
Description: This is a digitally signed message part.
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] From matrices to data.frames and vice versa

2011-11-25 Thread Arnaldo Russo
Hi Luca!
thats a good idea. If you could give feedback over yours code improvement,
I'll be glad.
It's a possibility with data.matrix

Cheers,
Arnaldo.

*Arnaldo D'Amaral Pereira Granja Russo*
Lab. de Estudos dos Oceanos e Clima
Instituto de Oceanografia
Universidade Federal do Rio Grande
e-mail arnaldorusso [at] gmail [dot] com
tel   (53) 3233-6855



2011/11/25 Luca Beltrame 

> In data venerdì 25 novembre 2011 07:18:24, Laurent Gautier ha scritto:
>
> > The "Python way" might be to add a switch in the constructors of the
> > relevant classes (rpy2.robjects.vectors.Matrix and
> > rpy2.robjects.vectors.DataFrame).
>
> I was thinking of something like (for DataFrame):
>
> def __init__(self, tlist=None, matrix=None):
>
> then going on. If this is a sensible design, I can try cooking up something
> and doing a pull request on bitbucket later on.
>
> --
> Luca Beltrame, Ph.D. - Translational Genomics Unit
> Oncology Department, Mario Negri Institute
>
>
> --
> All the data continuously generated in your IT infrastructure
> contains a definitive record of customers, application performance,
> security threats, fraudulent activity, and more. Splunk takes this
> data and makes sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-novd2d
> ___
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
>
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] From matrices to data.frames and vice versa

2011-11-25 Thread Luca Beltrame
I've been looking through the code and I have a couple of questions on design. 
I wonder if 

- it is preferable to hack in a special case of "tlist" being a Matrix in the 
DataFrame constructor, e.g. if isinstance(tlist, Matrix);
- it is preferable (like I suggested at first) to have a separate parameter to 
construct an instance from a Matrix.
- it is preferable using a class/static method to create a DataFrame from a 
matrix (e.g. DataFrame.from_matrix)

Opinions?

-- 
Luca Beltrame, Ph.D. - Translational Genomics Unit
Oncology Department, Mario Negri Institute


signature.asc
Description: This is a digitally signed message part.
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] From matrices to data.frames and vice versa

2011-11-25 Thread Laurent Gautier

On 2011-11-25 14:52, Luca Beltrame wrote:

I've been looking through the code and I have a couple of questions on design.
I wonder if

- it is preferable to hack in a special case of "tlist" being a Matrix in the
DataFrame constructor, e.g. if isinstance(tlist, Matrix);
- it is preferable (like I suggested at first) to have a separate parameter to
construct an instance from a Matrix.
- it is preferable using a class/static method to create a DataFrame from a
matrix (e.g. DataFrame.from_matrix)

Opinions?


May be there is no perfect solution.
Python does not have typed parameters in function signatures (includes 
methods and constructors), which pushes boilerplate code to consider 
separate types to the developer. Duck-typing can alleviate some of this, 
but is not always possible (one cannot always have a full control over 
the possible classes for a given parameter in the function).


Currently, the constructor to DataFrame accepts a "tlist" ("tagged 
list") as a main parameter. The idea was to be relying on duck-typing, 
somehow, and anything that would exhibit the behaviour (relevant methods 
or properties) of a tagged-list will be accepted. The implementation is 
slightly more complex because of a mixture of reasons ranging from 
patching shortcoming in the design, to impossibility to apply duck 
typing all the way, to quirks in R's own design. Your questions are 
triggering some thoughts, and may be there is a better way to implement 
this than it currently is.


The second option in your list (separate parameter) is, I think, the 
least desirable of the options as it is pushing some of the complexity 
back to the user (longer function signature, which optional parameter to 
use given the input).


The third option can be considered anyway, and called from the main 
constructor (so your code is broken down into separate units.


L.




--
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d


___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list