Quarto -- Data Frame Printing

I have recently found some time to start exploring Quarto. Pretty great! One feature that I used in my RMD files was the df_print: paged YAML option in HTML documents. This doesn't seem to work yet in Quarto. Is there a work around? Or maybe there is a YAML variation that I missed in the documentation?

3 Likes

I don't think this is something ported on Quarto yet to be able to change all data.frame printing using df_print. You should ask Quarto related question in quarto-dev/quarto-cli · Discussions · GitHub to that we can discuss this and track as possible feature request.

Possibly this is something we could make possible in knitr maybe :thinking:

For now, as with any table function, you need to call it directly in the chunk on the data.frame you want

---
title: "test"
---

```{r}
rmarkdown::paged_table(head(mtcars))
```

3 Likes

You can set custom knitr_print functions for data.frame objects. I wrote a demo gist and there are more details in this vignette.

If you just want all data frames to print as paged, add this code:

library(knitr)

knit_print.data.frame <- function (x, options, ...) {
  rmarkdown::paged_table(x, options) |>
    rmarkdown:::print.paged_df()
}

registerS3method("knit_print", "data.frame", knit_print.data.frame)
5 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

For using with R, Quarto has now a df-print option you can set in YAML:

So you can now set kable as default printing option now

1 Like