How to dynamically change the size of leaflet map in Shiny R?
<p>I want to know, how can we change the size of leaflet map in shiny R. For example consider the following code :</p>

<pre><code>library(leaflet)
library(shiny)

app = shinyApp(
  ui = fluidPage(
    sidebarLayout(
      sidebarPanel( sliderInput("obs",
                    "Number of observations:",
                    min = 0,
                    max = 1000,
                    value = 500)
        ),
      mainPanel(
        leafletOutput('myMap', width = "200%", height = 1400)
        )
    )
  ),
  server = function(input, output) {
    map = leaflet() %&gt;% addTiles() %&gt;% setView(-93.65, 42.0285, zoom = 17)
    output$myMap = renderLeaflet(map)
  }
)

if (interactive()) print(app)
</code></pre>

<p>For changing the size of map, I can change the width and height argument in ui. When I tried to change the same in server, it did not work out. </p>

<p>I do not know, any way in which one can change the parameters in ui through server. I tried this approach, but it did not work.</p>

<pre><code>library(leaflet)
library(shiny)

Height = 1000 
app = shinyApp(
  ui = fluidPage(
    sidebarLayout(
      sidebarPanel( sliderInput("Height",
                    "Height in Pixels:",
                    min = 100,
                    max = 2000,
                    value = 500)
        ),
      mainPanel(
        leafletOutput('myMap', width = "200%", height = Height)
        )
    )
  ),
  server = function(input, output) {
    Height &lt;- reactive(input$Height)
    map = leaflet() %&gt;% addTiles() %&gt;% setView(-93.65, 42.0285, zoom = 17)
    output$myMap = renderLeaflet(map)
  }
)

if (interactive()) print(app)
</code></pre>

<p>I just want to know, how to make the size of map dynamic so that I can control it. Any help  is greatly appreciated.</p>