Hi there!
I have a shiny app that saves some files to the temporary storage before they are zipped and downloaded. I want to show which files are present, in a nice way, e.g. with a textoutput or verbatimtextoutput, preferentially based on the saved files, or alternatively by tracking the state upon the clicks that generate the files.
However, I'd like to make the output a bit nicer, e.g. by adding linebreaks or some other text styling (bullet points) to increase readability.
Any ideas??
library(shiny)
library(stringr)
# Define UI for application
ui <- fluidPage(
titlePanel("FileTest"),
# Sidebar
sidebarLayout(
sidebarPanel(
h4("These are the files found by the app:"),
textOutput("File_List")
),
# MainPanel
mainPanel( )
)
)
# Define server logic
server <- function(input, output) {
# save some dummy files
write.csv(iris, "File 1.csv")
write.csv(iris, "File 2.csv")
write.csv(iris, "File 3.csv")
write.csv(iris, "File 4.csv")
# Retrieve list of saved files
File_List = reactive({
saved_files = list.files(pattern = "\\.csv")
saved_files = str_remove(saved_files, "\\.csv")
})
output$File_List = renderText( File_List() )
}
# Run the application
shinyApp(ui = ui, server = server)