title: How to turn off the layer display of addLayersControl first when launching the shiny app
body: <p>I am creating an app with shiny + leaflet.
  When I launch the shiny app for the very first time, I try to show all the default values of the layers displayed by addLayersControl.
  Is there a way to specify show / hide?</p>
  <p>For example, if you have the following code.
  (See <a href="https://stackoverflow.com/questions/50373497/r-leaflet-show-hide-addcontrol-element-with-group-layers">R leaflet - Show/Hide addControl() element with group layers</a>)</p>
  <pre><code>library(shiny)
  library(leaflet)
  
  data(quakes)
  quakes &lt;- quakes[1:10,]
  
  leafIcons_A &lt;- icons(
    iconUrl = &quot;https://leafletjs.com/examples/custom-icons/leaf-green.png&quot;,
    iconWidth = 38, iconHeight = 95,
    iconAnchorX = 22, iconAnchorY = 94)
  leafIcons_B &lt;- icons(
    iconUrl = &quot;https://leafletjs.com/examples/custom-icons/leaf-red.png&quot;,
    iconWidth = 38, iconHeight = 95,
    iconAnchorX = 22, iconAnchorY = 94)
  
  html_legend_A &lt;- &quot;&lt;img src='https://leafletjs.com/examples/custom-icons/leaf-green.png'&gt;green&lt;br/&gt;&quot;
  html_legend_B &lt;- &quot;&lt;img src='https://leafletjs.com/examples/custom-icons/leaf-red.png'&gt;red&lt;br/&gt;&quot;
  
  ui &lt;- fluidPage(
    leafletOutput(&quot;map&quot;)
  )
  server &lt;- function(input, output, session){
    output$map &lt;- renderLeaflet({
      dataA &lt;- quakes[quakes$mag &lt; 4.6,]
      dataB &lt;- quakes[quakes$mag &gt; 4.6,]
      
      map &lt;- leaflet() %&gt;% addTiles() %&gt;%
        addMarkers(dataA$long, dataA$lat, icon = leafIcons_A, group = &quot;Group A&quot;) %&gt;%
        addMarkers(dataB$long, dataB$lat, icon = leafIcons_B, group = &quot;Group B&quot;) %&gt;%
        addLayersControl(position = &quot;topleft&quot;, overlayGroups = c(&quot;Group A&quot;,&quot;Group B&quot;))
      map
    })
    
    observe({
      map &lt;- leafletProxy(&quot;map&quot;) %&gt;% clearControls()
      if (any(input$map_groups %in% &quot;Group A&quot;)) {
        map &lt;- map %&gt;%
          addControl(html = html_legend_A, position = &quot;bottomleft&quot;) %&gt;%
          addLegend(title=&quot;Group A&quot;, position=&quot;bottomright&quot;, opacity=1, colors=&quot;green&quot;,labels = &quot;Group A&quot;)}
      if (any(input$map_groups %in% &quot;Group B&quot;)) {
        map &lt;- map %&gt;%
          addControl(html = html_legend_B, position = &quot;bottomleft&quot;) %&gt;%
          addLegend(title=&quot;Group B&quot;, position=&quot;bottomright&quot;, opacity=1,colors=&quot;red&quot;,labels = &quot;Group B&quot;)}
    })
  }
  
  shinyApp(ui, server)
  </code></pre>
  <p>When executed, &quot;GroupA&quot; and &quot;GroupB&quot; are shown by default. Is it possible to control so that only &quot;GroupA&quot; is shown when shiny is started and &quot;GroupB&quot; is hidden?</p>