Parameters R markdown df_print

I have an R markdown in RStudio where a data table is printed. I want to set print options for data frames to control the printed number of rows and columns, as described here .

Here is a minimal example .Rmd file:

--- output: html_document: fig_height: 8 fig_width: 10 df_print: paged --- ```{r} knitr::opts_chunk$set(echo = FALSE) cars ``` 

Where / how to set rows.print parameter?

I tried this:

 --- output: html_document: fig_height: 8 fig_width: 10 df_print: paged rows.print: 25 --- 

which does not work (default 10 lines) and this:

 ```{r} knitr::opts_chunk$set(echo = FALSE, rows.print=25) cars ``` 

which also does not work.

+5
source share
1 answer

The parameter knitr::opts_chunk$set(rows.print=25) applies only to subsequent fragments, so in the minimum example it does not change the settings.

The parameter can be set in a piece, as shown in chunk1 or globally in opts_chunk for subsequent fragments.

 ```{r chunk1, rows.print=15} knitr::opts_chunk$set(echo = TRUE, rows.print=25) cars #15 rows printed ``` ```{r chunk2} cars #25 rows printed ``` 
+2
source

Source: https://habr.com/ru/post/1260599/


All Articles