Within rmarkdown (in RStudio) I use htmlTable package to generate nice looking tables in my html documents. Now I want the same result when rendering a pdf document. The tables aren't rendered properly. How can I let rmarkdown generate tables in my pdf document the same way it does in my html's?
This is a working example of a .Rmd file with a table:
--- title: "test" output: pdf_document --- ```{r results="asis"} library(htmlTable) c1 <- c("test1","test1","test2","test2") c2 <- c(1,2,3,4) data_object <- as.data.frame(cbind(c1,c2)) names(data_object) <- c("test","test2") print(htmlTable(data_object)) ``` Click knit pdf in RStudio.
The result in my pdf-document is:
test library(htmlTable) c1 <- c("test1","test1","test2","test2") c2 <- c(1,2,3,4) data_object <- as.data.frame(cbind(c1,c2)) names(data_object) <- c("test","test2") print(htmlTable(data_object)) test test2 1 1 1 2 1 2 3 2 3 4 2 4 1 The result (of the table part) should be:
Does anyone have an idea about how to solve this?

