Re: [Rpy] Arghh!!! RPY trials continue...Column naming fun.

2008-06-11 Thread Renato Alves
Thanks to all. The previous examples included a couple of extra "" causing the str error. This works fine now. Would you consider adding this to the documentation? I find the documentation/wiki coverage a bit short. These examples help a lot. Quoting Laurent Gautier on 06/11/2008 05:57 PM: > i

Re: [Rpy] Arghh!!! RPY trials continue...Column naming fun.

2008-06-11 Thread Laurent Gautier
import rpy foo = rpy.r.list(a=1, b=2, c=3) rpy.r["names"](foo) tmp = rpy.r["names<-"](foo, ['d', 'e', 'f']) rpy.r.str(tmp) List of 3 $ d: int 1 $ e: int 3 $ f: int 2 2008/6/11 Renato Alves <[EMAIL PROTECTED]>: > Still can't get it to work... Am I missing something? > > b <- r("'rownames<-'"

Re: [Rpy] Arghh!!! RPY trials continue...Column naming fun.

2008-06-11 Thread Warnes, Gregory
Grr. I need to slow down a bit. Lets see... I just tried this and it works properly: from rpy import * set_default_mode(NO_CONVERSION) x = r.matrix( r.rnorm(100), nrow=5 ) x = r.get("rownames<-")(x, ['a','b','c','d','e'] ) r.print_(x) A similar trick can be used for column

Re: [Rpy] Arghh!!! RPY trials continue...Column naming fun.

2008-06-11 Thread Daniel Dvorkin
On Jun 11, 2008, at 10:45 AM, Renato Alves wrote: > Still can't get it to work... Am I missing something? > > b <- r("'rownames<-'")(b, a) > TypeError: 'str' object is not callable I think you were right before -- in Python, that should be: b = r("'rownames<-'")(b, a) etc. The "<-" syn

Re: [Rpy] Arghh!!! RPY trials continue...Column naming fun.

2008-06-11 Thread Renato Alves
Still can't get it to work... Am I missing something? b <- r("'rownames<-'")(b, a) TypeError: 'str' object is not callable I'm with RPy version 1.0.3 [R version 2.7.0 (2008-04-22)] Quoting Warnes, Gregory on 06/11/2008 05:34 PM: > Sorry, I gave you the wrong magic > > x <- r("'rownames<-'")(x, f

Re: [Rpy] Arghh!!! RPY trials continue...Column naming fun.

2008-06-11 Thread Warnes, Gregory
Sorry, I gave you the wrong magic x <- r("'rownames<-'")(x, foo) -G On 6/11/08 12:01PM , "Renato Alves" <[EMAIL PROTECTED]> wrote: > Hi Gregory, > > I've been trying to understand how to do the equivalent with the > colnames function... without much success. > > I haven't been able to use yo

Re: [Rpy] Arghh!!! RPY trials continue...Column naming fun.

2008-06-11 Thread Renato Alves
Hi Gregory, I've been trying to understand how to do the equivalent with the colnames function... without much success. I haven't been able to use your suggestion. I always get the error: unexpected '[' in "[" Apart from this, is <- valid python syntax? Or did you meant to say = ? An example

Re: [Rpy] Arghh!!! RPY trials continue...Column naming fun.

2008-06-11 Thread Chris Arthur
Hi Gregory, Changing that to mod instead of r(mod) results in the following error Traceback (most recent call last): File "C:\Documents and Settings\Administrator\Desktop\pls\pls.py", line 40, in predicted=r.predict(mod, type='response', ncomp = 10, newdata = accFAS ) RPy_RException: Erro