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
Data.frames/tibbles not output as paged in RMarkdown after upgrading to R 3.5.0 #1331
Comments
@yihui I can repro this using R 3.5.0 and
the code chunk with paged printing is fine. The last code chunk (with grouping) yields a warning:
When previewing the notebook as HTML, the output for the last chunk is additionally garbled:
This has to to with the |
This might be a bad interaction between R 3.5 and RStudio -- I can't reproduce with R 3.4 and identical versions of |
Something appears to be going awry with S3 dispatch in the Notebook context. One can see the issue by attempting to debug the
When running this, I see: > debugonce(print)
> as_tibble(mtcars)
debugging in: function (x, ...)
UseMethod("print")(x)
debug: UseMethod("print")
Browse[2]> class(x)
[1] "tbl_df" "tbl" "data.frame"
Browse[2]> print.tbl_df
function (x, ...)
{
o <- overrideMap(x, options)
if (!is.null(o)) {
overridePrint(o$x, o$options, o$className, o$nRow, o$nCol)
}
}
<bytecode: 0x7fad5be20ec0>
<environment: 0x7fad44a37498> So it appears like the S3 override we've registered should be in scope for this print call. However, this is not the case -- the S3 method registered in Browse[2]> s
debugging in: print.tbl_df(x)
debug: {
cat_line(format(x, ..., n = n, width = width, n_extra = n_extra))
invisible(x)
} The NEWS file of R 3.5.0 has this:
So it seems like R has explicitly switched up the mechanism used for S3 dispatch, and this has broken the way we override the S3 methods when injecting our own printers. We'll have to think about how to accommodate this change in behavior. |
I've re-filed this over at rstudio/rstudio#2748. |
@agranholm Could you test the current latest version of RStudio (1.1.453)? |
I have now tested with R v. 3.5.0, RStudio v. 1.1.453, all packages including RMarkdown and knitr updated to the latest available on CRAN on macOS. The following works perfect - all are rendered as paged tables inline and in the html files.
Thanks for the heads up and for the attention to this issue! |
I'm using knitr in GraalVM. It works fine, but when printing tibbles I see the same error as reported here. Can you tell me what was the fix so I can try to replicate this in GraalVM? |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
Since upgrading to R 3.5.0, there appears to be an issue with inline display and rendering to html of data.frames/tibbles when using R Notebooks - they are not rendered as paged tables, unless it is a grouped tibble (and for now, grouping a tibble by any variable before displaying seems to solve the problem).
Reproducible example including the results of the rendering (and written how it appears inline in RStudio):
https://rpubs.com/Granholm/384010
This happens only in R Notebooks, and adding
df_print: paged
to the header does not solve it:When knitting a regular RMarkdown document to html with the header shown below, all the three examples in the above link are rendered as paged tables and are all displayed correctly inline in RStudio (inline, the data.frame and tibble are displayed as in the console and the grouped tibble is displayed as a paged table).
This appears to be present in both the most recent version of the rmarkdown package from CRAN and also the dev version from GitHub.
More people have been mentioning the issue in the RStudio Community forums:
https://community.rstudio.com/t/issues-with-r-markdown-notebook-in-r-3-5-0-not-displaying-tibble-df-nicely-inline/7651
https://community.rstudio.com/t/kable-results-not-displaying-inline/7828/4
I don't know if this is mostly an issue related to rmarkdown or knitr, so feel free to redirect me and close this issue if better suited elsewhere.
The text was updated successfully, but these errors were encountered: