Nathaniel Smith wrote:
> On Mon, Mar 23, 2009 at 5:31 PM, Brandon Invergo
> <bran...@brandoninvergo.com> wrote:
>> The data is loaded as expected, but when I try to
>> print the output to the console, only a portion of the data.frame is
>> printed (~65000 characters), presumably because it reached the maximum
>> string size, and then a seemingly-unrelated GTK widget breaks (but we'll
>> ignore that part for now)
> 
> Hard to tell what exactly's going on from here, but Python itself is
> quite happy to create and manipulate strings much larger than 65k --
> its maximum is somewhere in the gigabytes range, if that. (That's a
> suspicious number, though -- perhaps some of your widgetry somewhere
> has a 2**16 limit?)

What is going on is not clear, but the reason might somewhere else than 
in the widget.

I tried with the GTK console at:
http://bitbucket.org/lgautier/rpy2/src/813a7bc798ae/demos/radmin.py
as well and in a Python console with:

import rpy2.robjects as ro
gaus = ro.r['rnorm'](70000)
print(gaus)

The printed vector is apparently truncated (while it is not when printed 
from a genuine R console).


>> What seems ideal to me would be a way to grab the R console output one
>> line at a time rather than all at once so I can just append those lines
>> individually to my gtk text buffer. I can easily do this for a specific
>> task, such as only for a data.frame, programmatically break it apart by
>> rows. However, I'm hoping for something more general that could apply to
>> any output.

Erh... did you check the example ?
http://bitbucket.org/lgautier/rpy2/src/813a7bc798ae/demos/radmin.py
It seems to be doing what you are looking for.

>> I have tried to set robjects.rinterface.setWriteConsole(f) to some
>> function f that just appends to a buffer, but that console callback
>> function doesn't seem to append anything to the buffer if I do a call to
>> robjects.r("some command here").
 >
> robjects.r("foo") doesn't print anything itself. (Unless 'foo' calls
> the print() function.) Try robjects.r("print(foo)") or
> robjects.r["print"](robjects.r("foo")).

The confusion might occur because genuine R console calls print on an 
object (a bit like a Python console calls the method __repr__() ).



L.


> -- Nathaniel
> 
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to