Re: [Rpy] RDataFrame to Python objects?

2008-12-09 Thread Laurent Gautier
RDataFrame *is* a Python class. There are many ways to cast it into a different data structure, if you wish to do so. If going for a list of lists: lolist = [[x for x in y] for y in dataf] Note that going to a Python dictionary is not the most robust of the ideas (there might be several elemen

Re: [Rpy] RDataFrame to Python objects?

2008-12-09 Thread Laurent Gautier
Edit to the PS in my previous post: I did have the time to make RVectors use R's "[". use ".r[", e.g. dataf.r['Var1'] L. Carlos Jesus Anderson wrote: > Hi, > > How may I convert an RDataFrame into Python objects? I used the read.table > function in R to read in data (from Python), but now

Re: [Rpy] RDataFrame to Python objects?

2008-12-09 Thread carlosja
Thanks for your quick response, Laurent. I tried your suggestions and they worked, but there's still one problem. One of my columns are strings, but when I use the ".r[" operator, I get a list of numbers AND the list of strings. I have no idea what the numbers represent. When I type data.r["V4"]

Re: [Rpy] RDataFrame to Python objects?

2008-12-09 Thread Marcos Silva
Factors are represented by integers numbers in R. I think the numbers you got are the integer representation of factors in your data frame. Maybe if you convert factors for character you can solve the problem... See the help for the factor() function. 2008/12/9 <[EMAIL PROTECTED]> > Thanks fo

Re: [Rpy] RDataFrame to Python objects?

2008-12-09 Thread Laurent Gautier
[EMAIL PROTECTED] wrote: > Thanks for your quick response, Laurent. I tried your suggestions and > they worked, but there's still one problem. One of my columns are > strings, but when I use the ".r[" operator, I get a list of numbers AND > the list of strings. I have no idea what the numbers re

Re: [Rpy] RDataFrame to Python objects?

2008-12-09 Thread Carlos J. Anderson
I'm using version 2.0.0rc1. I think that Marcos's suggestion (thanks!) that R is converting my strings to factors is correct. I just need to figure out how to convert them back to strings. Seems like my problem is more of an R issue than an rpy2 issue. Still, I wonder how print() is able to pro

[Rpy] Saving plots made with rpy

2008-12-09 Thread Eric Sun
Hi, I'm trying to use Rpy2 to save some plots that I've created using python2.5 + rpy2 + R 2.8.0. The plot displays in my X11 window fine, but I can't seem to save it. If I do r.png("filename.png", width=600, height=600) r('dev.off()') it creates a file called filename.png that's 0 bytes. If I

Re: [Rpy] RDataFrame to Python objects?

2008-12-09 Thread Laurent Gautier
Carlos J. Anderson wrote: > I'm using version 2.0.0rc1. Update to the released 2.0.0 should probably be the first thing to consider. > I think that Marcos's suggestion (thanks!) that R is converting my > strings to factors is correct. which is in the man page for R's read.table() > I just need

Re: [Rpy] Saving plots made with rpy

2008-12-09 Thread Eric Sun
Nevermind, I figured it out. The solution is to call r.bitmap *before* calling the plot() command, and not after. whoops. On 12/9/08 2:56 PM, "Eric Sun" <[EMAIL PROTECTED]> wrote: Hi, I'm trying to use Rpy2 to save some plots that I've created using python2.5 + rpy2 + R 2.8.0. The plot displ

Re: [Rpy] Saving plots made with rpy

2008-12-09 Thread Kevin J. Thompson
where are your plot functions? they should be between the device calls. Hi, I'm trying to use Rpy2 to save some plots that I've created using python2.5 + rpy2 + R 2.8.0. The plot displays in my X11 window fine, but I can't seem to save it. If I do r.png("filename.png", width=600, height=600) r