-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running examples apparently uses print()
instead of show()
#2848
Comments
My understanding is that I think we could try overloading Lines 19 to 30 in 18cca45
|
The documentation for
I believe there is a typo in this; the word after "automatically" should be "as", not "is". But it is clear that if an S4 object is created on the console, it should be displayed using the The context of this issue is how pkgdown renders examples. A look at the code for The tarballs for emmeans versions 1.10.6 and earlier are available from CRAN and could be used to test if the right thing is being done. Version 1.10.7 contains a workaround to force pkgdown to render example outputs correctly. But with 12,000 R packages (I think that's about the number), surely this issue occurs with some other packages. |
You had me doubting myself, but I think
You can see this goes through the default method:
And a look at the code for So I think you fix the problem simply by replacing line 28 of |
Can you install this branch and rebuild your site? pak::pak("r-lib/pkgdown@show-examples") |
@jayhesselberth OK, I have done this, and the branch seems to work correctly. First, I reverted to the previous Consider the first example for The example run from the console:
This should be considered the "correct" results since it is what we see on the console. The example after building the site with pkgdown 2.1.1:
This is incorrect. The example after building the site with pkgdown 2.1.1.9000:
This is correct. I can try to send you a link to the complete sites if you need them, but this satisfies me that the issue has been addressed. Thanks. PS -- My regular pkgdown site for emmeans at github.io has not been modified. That site is built by GitHub action. It looks correct because it is based on my modified |
My package has different
print()
andshow()
methods. When I enter an expression on the console, the results are displayed usingshow()
, notprint()
. A case in point is running example code for package functions. I think we would want to see what's displayed on the console; however, evidently pkgdown renders example results usingprint()
rather thanshow()
.I noticed this snippet for the man page for
emmeans::ref_grid()
on my pkgdown site:The above results are what is shown using
print()
. However, if I enter the code on the console, I see:... which are the results of
show()
.I also note that the reprex package *does use
show()
. Here are results usingreprex::reprex()
:Created on 2025-01-30 with reprex v2.1.1
What we see here is the default, plus explicit pipes to
show()
andprint()
.I believe that pkgdown should use
show()
when it renders example output.Note
I reference my site above, but probably by the time you review this issue, it will be rendered differently, as I changed the
print
method toshow
so as to get what I want to see on the site. However, I still think this is a bug in pkgdown and will revert to my old code when you fix it.The text was updated successfully, but these errors were encountered: