>
> Hello!
>
> I solved this problem(finally!) and thought I would put up the solution if
> anyone was interested. The only thing that's left is converting my output to
> a dictionary...which I am still working on.
>
> Here's what it looked like:
>
> from numpy import *
> from scipy import *
> from rpy2.robjects import r
> import rpy2.robjects.numpy2ri
>
> r.library("survcomp")
> r.assign('prob',prob)
> r.assign('survTime',survTime)
> r.assign('survEvent',survEvent)
>
> cIndexData = r('cInd<-concordance.index(x=prob, surv.time = survTime,
> surv.event = survEvent, method=\"noether\",outx=\"TRUE\")')
>
> *
> *
> *So, things that made a difference:*
>
> 1. Using *assign* and putting the variables in the R environment
> 2. I was getting my data from an SQL database and it was converting
> survTime to decimal type, so I altered my code to convert to float.
> 3. Previously, my data was stored in lists, after much investigation
> (thanks to the help of rpy2)  I found out lists end up having a strange
> conversion in R, so that's why I was getting the length error. I used numpy
> arrays instead and *rpy2.robjects.numpy2ri *to convert between numpy and
> R. This ended up doing the trick.
>
> Thanks for everyone that offered help. I am really new to RPy, so perhaps
> my solution was actually really obvious. I didn't think of all these
> variables : )
>
>
>
>
> On Mon, Apr 18, 2011 at 10:25 AM, Peter <rpy-l...@maubp.freeserve.co.uk>wrote:
>
>> On Mon, Apr 18, 2011 at 5:24 PM, Anamaria Crisan
>> <anamaria.cri...@gmail.com> wrote:
>> > Hi,
>> > I've tried changing the conversion mode as suggested, however it will
>> die at
>> > the  r_result = cindex(x=prob, surv_time=survTIME, surv_even=survEVENT)
>> > line.  I don't know how often R methods have var.name , but if someone
>> else
>> > has successfully run such a method before that would be good to know. My
>> > code works in R; even if I put it in an RPy module with no other code
>> (and
>> > line for line as it was done in R) it fails. There has to be some
>> conversion
>> > issue happening, but I don't know how to fix it. Additionally RPy2
>> hasn't
>> > solved the problem yet.
>>
>> Can you give a self contained example in R, and your attempt in Python?
>> e.g. Try using one of the many built in example datasets in R.
>>
>> Peter
>>
>
>


-- 
Anamaria Crisan
Medical Genomics Research Associate
GenomeDx Biosciences Inc. | 201-1595 W. 3rd Ave, Vancouver, BC V6J 1J8
Off: 604-568-7570 | Fax: 866-505-5161
ana <http://goog_1098469627>@genomedx.com
www.genomedx.com
------------------------------------------------------------------------------
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