I have a R markdown document in RStudio, where a data.table is printed. I want to set the data frame print options to control printed number of rows and columns, as described h
The knitr::opts_chunk$set(rows.print=25)
option setting applies only to subsequent chunks, hence in the minimal example it doesn't change the setting.
The option can be set in the chunk as shown in chunk1
or globally in opts_chunk
for subsequent chunks.
```{r chunk1, rows.print=15}
knitr::opts_chunk$set(echo = TRUE, rows.print=25)
cars #15 rows printed
```
```{r chunk2}
cars #25 rows printed
```