I have the following code:
---
title: "test"
author: "author"
date: "2020/11/17"
output: pdf_document
always_allow_html: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r cars}
library(compareGroups)
export2md(createTable(compareGroups(Species~.,data=iris)))
```
I use the following command to run this code:
rmarkdown::render("test.Rmd")
I expect that the table will look like this:
Summary descriptives table by groups of `Species'
setosa versicolor virginica p.overall
N=50 N=50 N=50
Sepal.Length 5.01 (0.35) 5.94 (0.52) 6.59 (0.64) <0.001
Sepal.Width 3.43 (0.38) 2.77 (0.31) 2.97 (0.32) <0.001
Petal.Length 1.46 (0.17) 4.26 (0.47) 5.55 (0.55) <0.001
Petal.Width 0.25 (0.11) 1.33 (0.20) 2.03 (0.27) <0.001
But ends up looking like this in the PDF I produce from the Rmarkdown code:
library(compareGroups)
export2md(createTable(compareGroups(Species~.,data=iris)))
## Warning in export2md(createTable(compareGroups(Species ~ ., data = iris))): You are calling export2md ## -> html format is assigned
Summary descriptives table by groups of ‘Species’
setosa
versicolor
virginica
p.overall
N=50
N=50
N=50
Sepal.Length
5.01 (0.35)
5.94 (0.52)
6.59 (0.64)
<0.001
Sepal.Width
3.43 (0.38)
2.77 (0.31)
2.97 (0.32)
<0.001
Petal.Length
1.46 (0.17)
4.26 (0.47)
5.55 (0.55)
<0.001
Petal.Width
0.25 (0.11)
Why would this be and what can I do to properly display the table in my exported pdf?