Mutually dependent input sliders in R shiny
<p>I try to make two mutually dependent input sliders in a shiny app but don't seem to get it to work. I plan to use this kind of situation in a shiny app and for ease illustrate it here with a simplified 'glass half empty / full' example in which one slider should show glass fullness and one emptyness:</p>

<pre><code>library(shiny)

ui =(pageWithSidebar(
  headerPanel("Glass fullness"),
  sidebarPanel(
    sliderInput("Full", "% water", min = 0, max = 1, value = 0.2),
    #display dynamic UI
    uiOutput("Empty")),
  mainPanel()
))

server = function(input, output, session){

  # make dynamic slider 
  output$Empty &lt;- renderUI({
    sliderInput("Empty", "% air", min=0, max=1, value=1-input$Full)
  })

}

runApp(list(ui = ui, server = server))
</code></pre>

<p>I understand the <code>value = 0.2</code> and <code>value=1-input$Full</code> cause above code only to make the second slider dependent on the first but not the other way around. My problem is that I want to make both dependent on each other. I tried adding an uiOutput("Full") &amp; dynamic slider for Full but did not manage to work around circular coding.</p>

<p>The result of above code looks as follows:</p>

<p><a href="https://i.stack.imgur.com/pSYlk.png" rel="noreferrer">Glass half empty/full screenshot</a></p>

<p>Any help greatly appreciated! </p>