You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Buggy print() call works with inline output when it shouldn't #16483
Just to confirm -- an error here is the expected result, given that this is the same behaviour you would see if you ran this code in a "plain" R session. Is that right?
I think the confusion here arises because pillar:::print.tbl() accepts an argument n, and so the invocation of print(n = distinct(n)) ends up with n assigned (expectedly? unexpectedly?) that value.
On the other hand, the print() wrappers that we install to capture table output effectively "block" the S3 dispatch to the print method you were expecting, and so this error doesn't happen.
The problem is that code appears to work when running the code cells one by one but then fails when you render the document. This has been confusing for students learning R in Quarto documents.
This will execute successfully in both cases, but in a chunk with inline output you would still see the regular paged table representation (with no truncation of the view), while in the console you get the truncated view with only 3 rows of output.
One proposal would be for us to only use a paged-table representation for "auto-printed" tibbles, e.g. if you evaluate a statement that returns a tibble without explicitly printing it, versus the user explicitly calling print() on the object. Then, if print() is called, the user would have consistent behavior regardless.
@mine-cetinkaya-rundel, do you have any opinions on what we should do in this situation?
My vote would be for consistency, therefore the idea of using a paged-table representation for "auto-printed" tibbles makes sense to me.
Or, if folks are used to seeing the paged-table representation, print(n = 3) should still only print the top 3 rows, I think.
Going with the first option would make the code I provided at the beginning of this thread fail when running the individual code cell, which I think is preferable. This way there's no expectation the Quarto document would render either.
Activity
gtritchie commentedon Sep 26, 2025
Also reproduces in 2025.05.1+513.
Happens with RMarkdown files as well.
kevinushey commentedon Sep 26, 2025
Just to confirm -- an error here is the expected result, given that this is the same behaviour you would see if you ran this code in a "plain" R session. Is that right?
I think the confusion here arises because
pillar:::print.tbl()accepts an argumentn, and so the invocation ofprint(n = distinct(n))ends up withnassigned (expectedly? unexpectedly?) that value.On the other hand, the
print()wrappers that we install to capture table output effectively "block" the S3 dispatch to the print method you were expecting, and so this error doesn't happen.Fixing this feels kind of dicey.
mine-cetinkaya-rundel commentedon Sep 27, 2025
Correct, error is the expected result.
The problem is that code appears to work when running the code cells one by one but then fails when you render the document. This has been confusing for students learning R in Quarto documents.
ronblum commentedon Sep 29, 2025
Putting into "Later" for now due to the diciness, keeping it open in "Later" for reconsideration.
kevinushey commentedon Oct 1, 2025
Somewhat related is the fact that you'll ultimately get different outputs even if you had code like:
This will execute successfully in both cases, but in a chunk with inline output you would still see the regular paged table representation (with no truncation of the view), while in the console you get the truncated view with only 3 rows of output.
One proposal would be for us to only use a paged-table representation for "auto-printed" tibbles, e.g. if you evaluate a statement that returns a tibble without explicitly printing it, versus the user explicitly calling
print()on the object. Then, ifprint()is called, the user would have consistent behavior regardless.@mine-cetinkaya-rundel, do you have any opinions on what we should do in this situation?
mine-cetinkaya-rundel commentedon Oct 2, 2025
My vote would be for consistency, therefore the idea of using a paged-table representation for "auto-printed" tibbles makes sense to me.
Or, if folks are used to seeing the paged-table representation,
print(n = 3)should still only print the top 3 rows, I think.Going with the first option would make the code I provided at the beginning of this thread fail when running the individual code cell, which I think is preferable. This way there's no expectation the Quarto document would render either.
ronblum commentedon Oct 14, 2025
In RStudio Desktop 2025.11.0-daily+217 one Windows 11, I'm getting the following error with both of the examples above:
ronblum commentedon Oct 22, 2025
Verified in RStudio Desktop 2025.11.0-daily+261.pro1 on Windows 11.
complete BRAT to Playwright migration (#17713)