2008/2/21, Lore Merdrignac <[EMAIL PROTECTED]>: > > > Date: Thu, 21 Feb 2008 08:16:10 -0500 > > From: [EMAIL PROTECTED] > > To: rpy-list@lists.sourceforge.net > > Subject: Re: [Rpy] help with the package survival > > > > > On Thu, Feb 21, 2008 at 8:08 AM, Lore Merdrignac <[EMAIL PROTECTED]> > wrote: > > > > > > Hi, > > > I have a problem with the package "survival" in rpy. I have to use the > > > function survit() , and it works with R but not by calling R from python > > > with rpy : > > > > > > >>> ss=r.survfit(s,weights=pds) > > > Traceback (most recent call last): > > > File "<interactive input>", line 1, in ? > > > RPy_RException: Erreur dans UseMethod("survfit") : pas de méthode > applicable > > > pour "survfit" > > > > > > It seems that there is nothing implemented in rpy for this function... > > > Do you know how I can manage this problem ? Have I made mistakes ? Or do > > > you know what function I could use to have similar results ? > > > > Lore, > > > > You'll probably need to show how you construct "s", as it seems that > > survfit is looking for a particular type of object. If "s" is not a > > formula or a coxph object, that would explain the error. Note that > > there is type-conversion going on in rpy, so even though "s" might > > have started out as the correct type of object, it may not be by the > > time you are calling the function here. > > > > Sean > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio 2008. > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > _______________________________________________ > > rpy-list mailing list > > rpy-list@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/rpy-list > > > > Thank you for your reply Sean. > > So, this is how I proceed with R : > > d=rep(1,41) > > t=c( rep(6,5), rep(9,3) , rep(12,24), rep(15,9) ) > > plot(survfit(Surv(t,d))) > And I get a graph of life span. > > With rpy : > >>> from rpy import r > >>> r.library("survival") > >>> d=r.rep(1,41) > >>> t=r.c( r.rep(6,5), r.rep(9,3) , r.rep(12,24), r.rep(15,9) ) > >>> r.plot(r.survfit(r.Surv(t,d))) > Traceback (most recent call last): > File "<interactive input>", line 1, in ? > RPy_RException: Erreur dans UseMethod("survfit") : pas de méthode applicable > pour "survfit" > > Or : > >>> s=r.Surv(t,d) > >>> ss=r.survfit(s) > Traceback (most recent call last): > File "<interactive input>", line 1, in ? > RPy_RException: Erreur dans UseMethod("survfit") : pas de méthode applicable > pour "survfit" > > Is there a mistake...?
Not really... it is just that the conversion Sean was referring to seems to be happening (and is causing confusion - there are improvements coming on that front, but that will be for an other post). You can try turning the conversion off with rpy.set_default_mode(rpy.NO_CONVERSION) prior to running your code. > Thank you for your time Sean. > > Lore. > > > > > > ________________________________ > Windows Live Messenger 2008 vient de sortir, encore plus de fun ! > Téléchargez gratuitement Messenger 2008 > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > rpy-list mailing list > rpy-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rpy-list > > -- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iEYEARECAAYFAkYgwJ4ACgkQB/w/MLoyRDeQlgCeMp8v69/Wy24Q4IaBVhoG1M5R 2h4AoIOTvKbrFpTklRDjV7u8tEOeSQqt =JPph -----END PGP SIGNATURE----- ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list