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 to figure out how to convert 
> them back to strings.

One way is to use R's as.character().

> Seems like my problem is more of an R issue than 
> an rpy2 issue.  Still, I wonder how print() is able to properly pull out
> the correct strings.
> -- Carlos
> 
> Laurent Gautier wrote:
>> [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 represent. 
>>> When I type data.r["V4"] I get something like this:
>>>
>>> structure(list(V4 = structure(c(17L, 17L, ...), .Label = c("string1", 
>>> "string2", ...), class = "factor")), .Names = "V4", class = 
>>> "data.frame", row.names = c(NA, -39L))
>>
>>
>> What version of rpy2 are you using ?
>> The __repr__() method was changed shortly before the release in order 
>> to something giving a more compact output.
>>
>>> I typed the "..." to avoid too many details (also, I changed my 
>>> actual strings to "string1", "string,", etc). I'm not sure what this 
>>> structure means, but I just want to get the strings as a list. Oddly 
>>> enough, when I type print(data), it correctly prints out the strings, 
>>> not the numbers.
>>>
>>> Thanks,
>>>
>>> Carlos
>>>
>>> Quoting "Laurent Gautier" <[EMAIL PROTECTED]>:
>>>
>>>  > 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 I
>>>  >> want to treat the data as Python objects, like a dictionary or a set
>>>  >> of lists. I don't want to work with RVectors. Thanks, Carlos
>>>  >>
>>>  >>
>>>  >> 
>>> ------------------------------------------------------------------------------
>>>  
>>>
>>>  >> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las 
>>> Vegas, Nevada.
>>>  >> The future of the web can't happen without you.  Join us at MIX09 
>>> to help
>>>  >> pave the way to the Next Web now. Learn more and register at
>>>  >> 
>>> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>>>  
>>> <http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/>
>>>  
>>>
>>>  >> _______________________________________________
>>>  >> rpy-list mailing list
>>>  >> rpy-list@lists.sourceforge.net
>>>  >> https://lists.sourceforge.net/lists/listinfo/rpy-list
>>>  >
>>>  >
>>>  >
>>>
>>
>>
>>


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to