简体   繁体   中英

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.

截屏

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

截屏

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!

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
)
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM