yefersonG
yefersonG

Reputation: 153

generate tables in Rmarkdown

Hello I have problems to generate the tables correctly, instead of being under the code they go up to the beginning of the page as shown below:

enter image description here

The code that I use as an example is the following

{r,echo=FALSE,size="tiny",warning=FALSE,message=FALSE}

sample<-mtcars[1:4,1:3]

kbl(sample,booktabs=T) %>%
kable_styling(latex_options=c("striped"))

It prints the table correctly but the result is up to the top, what is the reason for this problem?

Upvotes: 0

Views: 852

Answers (2)

Harrison Reed
Harrison Reed

Reputation: 21

I ran you code and did not have the same issue.

I'm currently using Rstudio v1.5.1717 with R version 4.1.2

I ran your code as an R-Notebook as a "chunk":

{r,echo=FALSE,size="tiny",warning=FALSE,message=FALSE}

sample<-mtcars[1:4,1:3]

kbl(sample,booktabs=T) %>%
kable_styling(latex_options=c("striped"))

Upvotes: 1

stomper
stomper

Reputation: 1387

Have you tried changing to echo = TRUE

{r,echo=TRUE,size="tiny",warning=FALSE,message=FALSE}
library(dplyr)
library(kableExtra)


sample<-mtcars[1:4,1:3]

kbl(sample,booktabs=T) %>%
kable_styling(latex_options=c("striped"))

enter image description here

Upvotes: 0

Related Questions