I have a very short question : how can I access the list of variables defined in a R Shiny App ?
I am looking to something equivalent to the ls()
function, which does not work as expected in R Shiny...
I would be very grateful if you could help.
Thanks in advance
Here a piece of code with what I would like to do:
library(shiny)
my_file1 = "monfichier.txt"
my_file2 = "monfichier.txt"
ui = fluidPage(
fluidPage(
br(),
fluidRow(
verbatimTextOutput('print_fichiers')
)
)
)
server <- function(input, output,session){
output$print_fichiers <- renderPrint({
## I would like to use ls() function
# to print the ''hard-coded'' filename stored
# in the variables that match the pattern ''file''
all_files <- ls()[grepl("file", xx)]
for(ifile in all_files) {
# would like to print
# my_file1 = monfichier.txt and so on
print(paste0("\n", ifile, "\t=\t\"", get(ifile) , "\"\n"))
}
})
}
shinyApp(ui = ui, server = server)