sharoz
sharoz

Reputation: 6345

Show all rows without tabs in RMarkdown

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

Upvotes: 4

Views: 1358

Answers (2)

sharoz
sharoz

Reputation: 6345

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

```{r results='asis'}

knitr::kable(mtcars)  

`` `

Upvotes: 1

TarJae
TarJae

Reputation: 79194

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)

Upvotes: 2

Related Questions