I\'m new to Shiny and struggling considerably.
I need to give my Shiny users the ability to download a data file (essentially querying a database). The query goes fr
I think capture.output is good solution for capturing text from console.
server <- function(input, output) {
values <- reactiveValues()
queryMagic <- function() {
print("Warning")
return("Data")
}
output$console <- renderPrint({
logText()
return(print(values[["log"]]))
# You could also use grep("Warning", values[["log"]]) to get warning messages and use shinyBS package
# to create alert message
})
logText <- reactive({
values[["log"]] <- capture.output(data <- queryMagic())
})
}
ui <- shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
),
mainPanel(verbatimTextOutput("console"))
)
))
shinyApp(ui = ui, server = server)