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

2008-06-21 Thread Laurent Gautier
Chris, Giving an example that works (or does not work, actually) straight out of a copy/paste is making it easier for anyone willing to help. I had a quick try at getting one, but cannot run the example in the documentation for the function 'plsr'. import rpy rpy.r.library('pls') rpy.r.data('yar

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

2008-06-19 Thread Chris Arthur
My message seemed to get a bit lost in that discussion so just to bring it back ... Changing that to mod instead of r(mod) results in predicted=r.predict(*r(mod)*, type='response', ncomp = 10, newdata = accFAS ) gives the following error Traceback (most recent call last): File "C:\Documents

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

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

2008-06-10 Thread Gregory Warnes
On Jun 10, 2008, at 9:20AM , Chris Arthur wrote: Thanks Gregory, that "y ~ ." syntax solves my problems. and allows my to pull out the PLSR data I wanted, but leads me to my next problem. Glad to help. I then try to use my model to predict the value of the matrix accFAS predicted=r.pr

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

2008-06-10 Thread Chris Arthur
Thanks Gregory, that "y ~ ." syntax solves my problems. and allows my to pull out the PLSR data I wanted, but leads me to my next problem. I generate PLSR model as follows mod=r.plsr(r("V83 ~ ."),ncomp=10,data=dataPLS,validation="CV") and test it by ploting ... r.plot(mod,ncomp=10 ) This works.

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

2008-06-09 Thread Gregory Warnes
You may find the forumula syntax y ~ . helpful. If data= is supplied to the modeling command, the single period means 'all variables in the data frame that are not otherwised mentioned. As for changing he names on an existing object, you can't use the rownames(x) <- foo syntax

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

2008-06-08 Thread Laurent Gautier
2008/6/7 <[EMAIL PROTECTED]>: > Hi Guys, sorry for the uninformative title. > > Basically If folk remember I am wanting to do some PLS regression on some > data. Folk on this list were kind enough to point me in the direction of > how to do this and I seem to have hit a really simple error which h

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

2008-06-07 Thread chris
Hi Guys, sorry for the uninformative title. Basically If folk remember I am wanting to do some PLS regression on some data. Folk on this list were kind enough to point me in the direction of how to do this and I seem to have hit a really simple error which has gorund me to a halt. So any chance of