Show all rows without tabs in RMarkdown

Viewed 288

If I output a data.frame in RMarkdown, the resulting HTML will only show 10 rows at a time.

How do I keep the nice formatting but show all rows?

For example if I want to output all rows of mtcars:

enter image description here

2 Answers

You can achieve this by setting the options pageLength of DT: Example rmd:

---
title: "Untitled"
author: "TarJae"
date: "5 2 2021"
output: html_document
---

chunk 1

knitr::opts_chunk$set(echo = TRUE)
library(DT)
options(DT.options = list(pageLength = 100, language = list(search = 'Filter:')))

chunk 2:

datatable(mtcars)

To keep the same formatting but drop the tabs/paging, use the following:

```{r results='asis'}

knitr::kable(mtcars)  

`` `
Related