Using this answer as a guide, I've been able to make custom text tables very easily in R Markdown. Here is an example r markdown document (saved as "test_rmd.Rmd"):
---
title: "Test"
output: html_document
theme: "yeti"
---
| Test 1 | Test 2 | Test 3 |
|--------|--------|--------|
| x | x | x |
| x | x | x |
| x | x | x |
| x | x | x |
When I knit the document in RStudio, it looks like this:
However, when I include this R Markdown file in my Shiny application, it presents the table completely differently. Here are the ui.R and server.R scripts and the resulting application:
ui.R:
library(shiny); library(shinythemes)
shinyUI(
bootstrapPage('',
navbarPage(
title = "Test",
theme = shinytheme("yeti"),
tabPanel("Example",
fluidPage(
div(id = "about",
class = "card",
includeMarkdown("./test_rmd.Rmd"))
)
)
)
)
)
server.R:
shinyServer(function(input, output, session) {})
runApp()
:
I have tried using kable
and the various other methods of "manually" creating tables in R, and I get the same problem. I have not explored creating a data.frame
and printing that in r markdown as the table I am making is all text and would be quite cumbersome in a data.frame
.
Any ideas? What am I missing here?
EDIT: Well, to give an update - I had to "re-draw" the specific tables in CSS to override this. Still not sure how/why/where Shiny is overriding the default R Markdown table formatting.