Reputation: 11
I am using RStudio to create a pdf using RMarkdown.
Whenever I use knitr::kable()
to display a dataframe, it generates the appropriate dataframe in the output below the code chunk, but also incorporates a large amount of redundant white space below the shown dataframe.
Note that when I knit the file, it formats as expected (I have no problem with how my file knits). Rather that when I am typing up my .Rmd file, the large areas of redundant white space under output are making it difficult to work, especially if I want to use kable()
to display dataframes/tables many times - it is inflating the scrolling length of my file with so many blank spaces.
When I use other packages such as pander, I do not have this problem. But it would be nice to have a fix for this as I prefer using kable()
.
My file is setup as:
---
title: "title"
author: "name"
date: "`r Sys.Date()`"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r warning = FALSE, message = FALSE}
library(knitr)
```
Inside my code chunk is written as follows:
```{r}
data <- read.csv("data.csv")
kable(head(data))
```
And the output within Rstudio is shown in this screenshot (didn't know how else to show what I mean, sorry) here. Is there some kind of setting on RStudio or in the setup of the RMarkdown document itself that can prevent the blank spaces displaying every time I execute code using kable()
?
Upvotes: 1
Views: 57