3

When I print a data frame with R Markdown (html_document), I get the following table (see image below) with the following example code :


title: "Motor Trend Car Road Tests"
output:
  html_document:
    df_print: paged
---

```{r}
mtcars
```

Printed Data Frame

Is there a way to hide the column types corresponding to the yellow highligting in the image?

M. P. R.
  • 93
  • 1
  • 8
  • 1
    Looks like that's the price of paged df printing, http://rmarkdown.rstudio.com/html_document_format.html#paged_printing However, you might be able to hide it with fancy custom css, hiding "pagedtable-header-type" divs or something. – Frank Sep 11 '17 at 20:23
  • 2
    simple option is to use `knitr::kable(mtcars)` – Richard Telford Sep 11 '17 at 20:53

1 Answers1

7

One option - Use the DT package.

---
title: "Motor Trend Car Road Tests"
output:
  html_document:
    df_print: paged
--- 

```{r}
DT::datatable(mtcars)
```

enter image description here

Daniel Anderson
  • 2,394
  • 13
  • 26
  • Sometimes when the size of the data frame is really big, `datatable` throws an error. Do you have any suggestions on how to display in that case without taking a sample of the data? – RD_ Feb 26 '20 at 20:43
  • I have not run into that but you could try reactable (https://glin.github.io/reactable/index.html) which is actually my preferred method these days. – Daniel Anderson Feb 26 '20 at 21:06