diffobj icon indicating copy to clipboard operation
diffobj copied to clipboard

Warn When Print Runs Out of Screen Room

Open brodieG opened this issue 7 years ago • 6 comments

Scan for:

 [ reached getOption("max.print") -- omitted 900001 entries ]

at end of inputs.

brodieG avatar Nov 15 '16 02:11 brodieG

Is there a way to avoid the truncation (output the full diff), other than the obvious one of changing max.print?

edit: Actually it seems even changing max.print before calling diffPrint() doesn't prevent the truncation. Why is that?

chambm avatar Apr 20 '17 17:04 chambm

If you're diffing character vectors (which you seem to be based on your prior comments), and you're not married to seeing them displayed the way R prints them (i.e.: [1] "a" "b" "c" etc.), then you can just use diffChr. That should be faster too.

Re max.print, not sure why it isn't working for you. I haven't tried printing something really large, but if I do:

> options(max.print=10)
> diffPrint(iris, iris)
No visible differences between objects.
< iris
> iris
@@ 1,4 / 1,4 @@
      Sepal.Length Sepal.Width Petal.Length Petal.Width    Species
  1            5.1         3.5          1.4         0.2     setosa
  2            4.9         3.0          1.4         0.2     setosa
   [ reached getOption("max.print") -- omitted 148 rows ]

It looks like max.print is having an effect.


EDIT: Actually, I just did

options(max.print=999999)
diffPrint(as.data.frame(diamonds), as.data.frame(diamonds))

and I got the whole data.frame.

brodieG avatar Apr 20 '17 18:04 brodieG

In this case I am diffing data.frames. I am trying to set max.print to the number of rows. It does have an effect but not what I'd expect. Is it applying the limit to the number of cells rather than rows?

Yeah, using your simple test case illustrates it's based on the number of elements/cells, even though it talks about omitting rows. That's confusing! I'll complain to base. ;)

chambm avatar Apr 20 '17 18:04 chambm

That would line up with the iris example above (two rows of five elements each shown with max.print=10).

Also, as a side note since you are diffing data.frames, you might want to set the disp.width value to be large enough such that your data.frames don't wrap as that causes some problems right now.

brodieG avatar Apr 20 '17 18:04 brodieG

Yeah that's set to 2000, arbitrarily (I imagine that's based on number of characters, right?

chambm avatar Apr 20 '17 18:04 chambm

It's the number of characters that you want to make available for print:

disp.width: integer(1L) number of display columns to take up; note that in "sidebyside" 'mode' the effective display width is half this number (set to 0L to use default widths which are 'getOption("width")' for normal styles and '80L' for HTML styles.

brodieG avatar Apr 20 '17 18:04 brodieG