aschmsu
aschmsu

Reputation: 312

Build R package vignettes with paged data frames

I'm trying to print pretty tibbles with df_print: paged option in my vignettes. My output settings are the following:

output:
  html_document:
    df_print: paged
    highlight: pygments
    number_sections: yes
    toc: yes

When I build vignettes with devtools::build_vignettes() locally I get the right HTML with paged tibbles.

Screenshot

But when I build the package on a TeamCity server, the installed package vignettes have tibbles printed in a usual way.

Screenshot

I've checked that rmarkdown::pandoc_available() is TRUE and rmarkdown package version is 2.6 (the rmarkdown::paged_table function is from v2.3).

What else do I need to check to build vignettes correctly?

Thanks in advance!

Upvotes: 4

Views: 250

Answers (1)

eduardokapp
eduardokapp

Reputation: 1751

That seems to be a simple problem. I believe there are two possible solutions:

1: You need to make sure that whatever script is running on your CI/CD in the TeamCity server has the same version of rmarkdown you're using locally. A great way to assert this issue is to run the CI/CD script locally (for example, a dockerfile script!) and trying to reproduce the problem. Another probable cause of the problem is that whatever your CI/CD is using to produce the markdown result is overwriting or ignoring certain yml tags. Look at Settings in .yml do not show up in rendered .Rmd, for example.

2: You can use DT::datatable in your vignette, which generates the same type of pretty tibble in a more reliable way.

DT::datatable(
your_tibble, 
extensions = c('FixedColumns',"FixedHeader"),
options = list(
     scrollX = TRUE, 
     paging=FALSE,
     fixedHeader=TRUE
)
)

Upvotes: 3

Related Questions