Assuming I have 2 r Rmarkdown files, When the user selects a certain input for example "1", I want to pull the first Rmarkdown file then, For each box in my dashboard, I want a specific section to be extracted from the selected Rmarkdown according to the box name. I would be so happy if you could assist me in this regard
library(shiny)
library(shinydashboard)
library(knitr)
ui <-
dashboardPage(
dashboardHeader(title ='Virtual Excursion'),
dashboardSidebar( sliderTextInput(
inputId = "mySliderText",
label = "Story line",
grid = TRUE,
force_edges = TRUE,
choices = c('1','2')
)
),
dashboardBody(
fluidRow(
column(9,
box(
title = "Operations ",
closable = FALSE,
width = 9,
status = "primary",
solidHeader = FALSE,
collapsible = TRUE,
uiOutput("operations")
)
)
),
fluidRow(
column(9,
box(
title = "Challenges",
closable = FALSE,
width = 9,
status = "primary",
solidHeader = FALSE,
collapsible = TRUE,
uiOutput("challenges")
)
)
)
)
)
server <- function(input, output,session) {
ChoseTheFile <- reactive({
if (input$mySliderText == 1 )
{
# chose the first Rmarkdown file
else
# chose the second Rmarkdown file
}
})
output$operations <- renderUI({
#1 knit ChoseTheFile()
#2 chose section 1 from ChoseTheFile()
})
output$challenges<- renderUI({
#1 knit ChoseTheFile()
#2 chose section 2 from ChoseTheFile()
})
}
shinyApp(ui = ui, server = server)