Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show all rows without tabs in RMarkdown

Tags:

r

r-markdown

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

like image 454
sharoz Avatar asked Oct 27 '25 01:10

sharoz


1 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)
like image 79
TarJae Avatar answered Oct 28 '25 16:10

TarJae