Below are three files to illustrate my question and the way my program is structured. What I want to do is use the bootstrap card and within it put an R variable (e.g., the result of some calculation). Is there a way I can do that with the HTML in a separate document?
For example, suppose myVariable <- 2^2 is done within the server file and I want the result of that calculation in the object myVariable to be inside the card where I've denoted "put R variable".
Thank you for advice or suggestions.
A simple ui.R file
ui <- fluidPage(
navbarPage(
theme = bs_theme(bootswatch = "flatly"),
title = 'Methods',
tabPanel('One'),
),
mainPanel(
h1('Hello World'),
includeHTML("foo.html")
)
)
A basic server.R file
library(shiny)
library(bslib)
server <- function(input, output) {
}
Contents of foo.HTML
<div class="card text-center">
<div class="card-header">
Featured
</div>
<div class="card-body">
<h5 class="card-title">Special title treatment</h5>
<p class="card-text">I want to put an R variable here</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
<div class="card-footer text-muted">
2 days ago
</div>
</div>
