Richard, I have not been using rpy all that long, but it seems powerful to me. 
I suggest first reading rpy documentation and especially the sections on 
notation of underscores. 

Second, when I use scripts I generally create a file/script and then call the 
script from python/rpy. There are probably several ways to do this, but here is 
a general outline to get you started:
from rpy import *
regression_Rcode_File = "your_path_and_filename_here"

#Source the script
r.source(regression_Rcode_File)

#Assign a name to the function in script and it can then be called as such
#It is necessary to define the data in python and then pass via rpy as well
fitted_model = r.lm(x, y, wgt)


A good example that I referred to when I first started learning (This also 
includes an example for plotting): 
http://www2.warwick.ac.uk/fac/sci/moac/currentstudents/peter_cock/python/lin_reg/


I hope this is helpful,
mike

----- Original Message ----
From: richard mendes <[EMAIL PROTECTED]>
To: "RPy help,  support and design discussion list" 
<rpy-list@lists.sourceforge.net>
Sent: Tuesday, January 15, 2008 12:03:43 PM
Subject: Re: [Rpy] Fwd: R while loop


Hello Sean, 

The code that i was using was simply pasting the same code in python. 
r("
i<-1")  # i should use the attach statement i think
r("while (i <= length(groups) ) {")

r("png(file=sprintf('MAplot%03d.png', i), width=600, height=600)")

r("MAplot(rawAffyData, pairs=TRUE, plot.method='smoothScatter' 
which=groups[[i]])")
r("dev.off
()")
r("i<-i+1 }")



But i expect that using rpy in such a way is completely wrong. I'm just testing 
what can be done by rpy

Currently they have rserve running on a server that connects several app's to 
R. The only problem is that i couldn't

find a interface between python and rserve. 



Besides the lack of the interface, rserve caused a lot of maintenance problems 
so i suggested to look further into rpy as 

interface between the apps and R. 



I can't give you the exact error because i'm not in the office now but i think 
it was something about ''unsubscribe error'' and it gave the first line till { 
between brackets.




Hope this helps,



Thanks 



Richard



ps: if you need the exact error i will post it tomorrow ( for me :) )
               
               
               
             


On Jan 15, 2008 7:51 PM, Sean Davis <
[EMAIL PROTECTED]> wrote:




On Jan 15, 2008 1:38 PM, richard mendes <[EMAIL PROTECTED]> wrote:



Hello Rpy users,

Probably a very simple question but i couldn't find the answer in the
documentation.
i have a r script which uses a while loop, how should i execute this in rpy ?


the script looks like:

i<-1

while (i <= length(groups) ) {
                png(file=sprintf('MAplot%03d.png', i), width=600, height=600)
                MAplot(rawAffyData, pairs=TRUE, 
plot.method='smoothScatter' which=groups[[i]])
                dev.off()
                i<-i+1 }

if i normally run this in a r terminal everything will go fine but
running it from rpy line by line will give a error.





Hi, Richard.

What error are you getting?  And what is the python code that you are using?

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











      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
-------------------------------------------------------------------------
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

Reply via email to