Is there any way to write add a newline character in a Shiny Progress bar message? \n
or <br>
does not seem to work.
I am trying to convert one of my old codes into a shiny app. The code basically calls a number of functions one after another, all of which take some time to execute. From the app, I would like to know which functions have already executed and the amount of time each of them took. I am trying to achieve this using the progress bar feature. Do let me know if there are better ways to do this.
Below is my dummy code. \n
s are where I want to add a newline character. Let me know if what I am trying to do is not clear.
library(shiny)
ui <- fluidPage(
tags$head(tags$style(
HTML(".shiny-notification {position:fixed;top: 30%;left: 0%;right: 0%;}"))),
actionButton(inputId = "go", label = "Launch long calculation")
)
server <- function(input, output, session) {
observeEvent(input$go,{
withProgress(message = "doing task 1",value = 0,{
Sys.sleep(1.5)#task 1
setProgress(0.3,message = "doing task 2",detail = "\n task 1 done")
Sys.sleep(1.5)#task 2
setProgress(0.6,message = "doing task 3",detail = "\n task 1 done \n task 2 done")
Sys.sleep(1.5)#task 3
setProgress(0.9,message = "Almost done",detail = "\n task 1 done \n task 2 done \n task 3 done")
Sys.sleep(1.5)
})
})
}
shinyApp(ui, server)
This is what I am trying to achieve
Thanks in advance!