Hi there Christian,

I find it's easiest to use rpy if you minimize the number of data conversion 
steps you need. That is, write most of your code in R, wrap it in my.function, 
then call it from python via

r.source("my.source.file.R")
r.my_function(args)

Rather than constructing a data frame in python and passing it through rpy, 
write a wrapper function in R that accepts python lists (these are normally 
converted to vectors) and then constructs your data frame in the R code. This 
is really easy with list comprehensions, i.e.

r.my_function(
    [ seq.some_statistic for seq in self.seq_list ],
    col=[ seq.color for seq in self.seq_list ],
    )

Toby Dylan Hocking

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Christian
Jauvin
Sent: Wednesday, November 22, 2006 11:48 AM
To: rpy-list@lists.sourceforge.net
Subject: [Rpy] about the dim() function


Hello,
 
I am new to RPy, and I have a hard time trying to use a R function 
thats needs the number of dimensions of a data.frame I am passing it.
 
Here is an example:
 
from rpy import *
x = r.data_frame(x=r.c(1,3), y=r.c(2,4))
 
At this point, why doesn't 
 
r.dim(x) 
 
returns something like it would in R?
 
I have the feeling that maybe I'm missing something with conversion...
 
Thanks!
 
Christian
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to