[R] how to limit output to console beyond options(max.print) ?

Michael Lachmann lachmann at eva.mpg.de
Sat Aug 8 00:58:46 CEST 2009


I have code that generates a structure that includes in it 30 data
frames of size 57*1004.
It isn't so important why I needed shape of data frame, maybe I didn't....

I have options(max.print) set to a low number but it seems that this
does not have much effect - printing my structure still takes hours,
as does str()-ing it.

here is short code that exhibits and doesn't exhibit the problem:
z=matrix(0,20,1000)
x=list(1:10,1:10,list(z,z,z,z,z,z,z,z,z,z,z,z))

This causes no problem. But
z=matrix(0,20,1000)
z=data.frame(z)
x=list(1:10,1:10,list(z,z,z,z,z,z,z,z,z,z,z,z,z))

now print(x) takes a long time - I'm not sure why, and still prints
quite a lot of stuff even when max.print is 100, since it prints all
the column names.
str(x) really prints too much - it doesn't seem to really be limited
by max.options in this case.


Is there any way to really limit how much is printed on the output
beyond max.print?

---
The specific problem I had is this: I'm working with TeXmacs as the
front end to R, which sadly crashes or gets slow or stuck when too
much is printed as output. I was trying to understand code I wrote
some time ago which generates this big structure, and I couldn't
easily even find what the structure contains, how big the different
parts are, because too much was printed, and my front end got stuck on
every trial. I tried to limit the output with max.print, but that
didn't help in this case.
Setting some global option to limit R output would help the TeXmacs
frontend a lot...
--

Thanks,
Michael




More information about the R-help mailing list