The issue is probably that your surv_time variable is being translated
'back' into a python object.

 

Try  changing the conversion mode to NO_CONVERSION and explicitly
requesting conversion when you need to access the results in python.
I.E.

 

                import rpy

                rpy.set_default_mode(rpy.NO_CONVERSION)

 

                # YOUR CODE HERE

                

                r_result = cindex(x=prob, surv_time=survTIME,
surv_even=survEVENT)

 

                py_result=result.as_py(rpy.BASIC_CONVERSION)

 

-Greg

 

From: Anamaria Crisan [mailto:a...@genomedx.com] 
Sent: Friday, April 15, 2011 12:59 PM
To: rpy-list@lists.sourceforge.net
Cc: Peter
Subject: Re: [Rpy] Rpy and dot names

 

         

        I have one more point I would like to add.

         

        When I run all of the code in R, it works just fine. If I make a
small python file with exactly the code I ran in R, it gives me the
'not all arguments have the same length' error. I will continue to check
my code, but I am suspicious that its having trouble with the surv_time
variable and that the interface is really excepting surv.time and there
is some mistranslation. I will also try using RPy2 to see if anything
helps.

         

        Any further advice would be appreciated, but thanks for the help
so far : )

         

        On Fri, Apr 15, 2011 at 9:06 AM, Peter
<rpy-l...@maubp.freeserve.co.uk> wrote:

        On Fri, Apr 15, 2011 at 4:56 PM, Anamaria Crisan
<a...@genomedx.com> wrote:
        > I am using just Rpy. Would RPy2 be the solution?
        >

        Possibly - and in the long term it would be worth looking at,
        but there are quite a few API changes to beware of.
        
        Back in rpy (v1), to run an R command like:

        
        cindex(x=prob, surv.time=survTIME, surv.even=survEVENT)

        you should (as I recall) switch the dots to underscores in
Python
        for argument names etc:

        
        cindex(x=prob, surv_time=survTIME, surv_even=survEVENT)

        This is because dots are used in Python to access the methods
        and attributes of an object. Argument names can't have dots,
        that is what the SyntaxError is trying to tell you.
        
        The fact you then get an "not all arguments have the same
length"
        suggests there is a secondary problem in your script. I'm not
        familiar with the R package survcomp so I can't really guess.
        
        Peter

         

 

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to