Brilliant interface: save changes to inputs

I have a problem. I am trying to run a program with several settings that can be set in ui. In my case, the user may need to run the program with the same settings more than once. My problem is that if you upgrade or restart the user interface, everything will be set to the default values. For instance:

numericInput("1", 
            label = h4("...."),
                                        4,
                                        min=1, 
                                        max=100, 
                                        step=1 
                                        ),
                           br(),
                           numericInput("2", 
                                        label = h4("..."),
                                        1000000,
                                        min=1, 
                                        max=100000000, 
                                        step=1
                                        )

If I set numericInput "1" to 7 and restart the program, it will default to 4. Due to the fact that I have several such settings, it can be quite noisy. So my question is: "Is there a way to save the changes I made?"

Thank you:)

+4
source share
3

. , . HTML5 . javascript, api. :

devtools::install_github("johndharrison/shinyStorage")
library(shinyStorage)
library(shiny)

runApp(
  list(
    ui = fluidPage(
      addSS(),
      uiOutput("textExample")
      )
    , server = function(input, output, session){
      ss <- shinyStore(session = session)
      output$textExample <- renderUI({
        myVar <- ss$get("myVar")
        if(is.null(myVar)){
          textInput("textID", "Add some text to local storage")
        }else{
          textInput("textID", "Add some text to local storage", myVar)          
        }
      })

      observe({
        if(!is.null(input$textID)){
          if(input$textID != ""){
            ss$set("myVar", input$textID)
          }
        }
      })
    }
    )
  )

, . textInput, , hip hurray!!! R-, 10 . .

+5

POC , .

DPUT DGET - , . , , . $dataset . , , . .

server.R ui.R, , , , , , , .

server.R

shinyServer(function(input, output) {

  datasetInput <- reactive({
    switch(input$dataset,
           "rock" = rock,
           "pressure" = pressure,
           "cars" = cars)
  })

  output$summary <- renderPrint({
    dataset <- datasetInput()
    summary(dataset)
    dput(input$dataset, "inputdata_dataset")
  })

  output$view <- renderTable({
    head(datasetInput(), n = input$obs)
  })
})

ui.R

library(shiny)
shinyUI(pageWithSidebar(
  headerPanel("Shiny Text"),
  sidebarPanel(
    selectInput("dataset", "Choose a dataset:", 
                choices = c("rock", "pressure", "cars"),
                selected = dget("inputdata_dataset")),
    numericInput("obs", "Number of observations to view:", 10)
  ),
  mainPanel(
    verbatimTextOutput("summary"),
    tableOutput("view")
  )
))
+3

, . .

( ). , . , , , ( , ). , , . , .

shinyUI(navbarPage(title=div(img(src="---", height=72, width=72, align="left")), theme ="bootstrap.css", fluid=T,




                 tabPanel("Startseite",
tags$head(tags$script(HTML('
      Shiny.addCustomMessageHandler("jsCode",
        function(message) {
          console.log(message)
          eval(message.code);
        }
      );
    '))),

                        actionButton("Ja",
                                     label="Neue Berechnung beginnen",
                                     icon("upload",lib="font-awesome")),

                        actionButton("Nein",
                                     label="Bestehende Berechnung laden",
                                     icon("upload",lib="font-awesome"))),

               tabPanel("Einstellungen", progressInit(),

                        conditionalPanel(condition="input.Ja > 0",

                                         wellPanel(actionButton("save",
                                                                label="Einstellungen speichern",
                                                                icon("save",lib="font-awesome")
                                                                ),
                                                   br(),
                                                   br(),
                                                   navlistPanel("Einstellungen",



tabPanel("Interne Kalibrierung",
     conditionalPanel(condition="input.save> 0",

                      wellPanel(actionButton("freqbutton", "Frequenzschätzung durchführen"),
                                plotOutput("freqPlot")
                                ),


                                      wellPanel(actionButton("intthresbutton", "Berechnung der internen Threshold"),
                                                dataTableOutput("IntTable")
                                                ))


     ),
0

All Articles