Is there a way to write the inputs generated to a csv/excel file. For example the inputs selected are rendered by show_inputs
. But I also need to write this to a file. The main goal is to understand what all inputs are selected by users. The values should go on appending to the csv/excel file so that at the end of the end, i can see what all inputs are there. Can we achieve this?
library(shiny)
ui <- basicPage(
fluidRow(
column(
width = 6,
textInput('a', 'Text A',"a1"),
textInput('b', 'Text B',"b1"),
textInput('c', 'Text A',"c1"),
textInput('d', 'Text B',"d1"),
textInput('e', 'Text A',"e1"),
textInput('f', 'Text B',"f1"),
uiOutput('f1')
),
column(
width = 6,
tags$p(tags$span(id = "valueA", "")),
tags$script(
"$(document).on('shiny:inputchanged', function(event) {
if (event.name === 'a') {
$('#valueA').text(event.value);
}
});
"
)
,tableOutput('show_inputs')
)
)
)
server <- shinyServer(function(input, output, session){
output$f1 <- renderUI({
if(input$a == "a2"){
textInput('z', 'Text B',"z1")
} else {
NULL
}
})
AllInputs <- reactive({
x <- reactiveValuesToList(input)
})
output$show_inputs <- renderTable({
AllInputs()
})
})
shinyApp(ui = ui, server = server)