title: R Leaflet: Assign multiple groups to a layer to filter data and change column represented
body: <p>I am trying to find a way in R leaflet to include overlay buttons which filters out groups in the data. I also need to include radio buttons which switch the column which is being represented in the data. I can't seem to find a way to do this in R leaflet using the addLayersControl() function.</p>
  <p>I initial thought it would be possible to add multiple groups to a single layer and use baseGroups and overlayGroups (as seen in the code below). However, this does not achieve the desired results. I would appreciate it if someone could suggest an alternative way to achieve this. Preferably without shiny.</p>
  <pre><code>library(dplyr)
  library(leaflet)
  
  data &lt;- data.frame(Name = c(&quot;A&quot;, &quot;A&quot;, &quot;A&quot;, &quot;B&quot;, &quot;B&quot;, &quot;C&quot;, &quot;C&quot;, &quot;C&quot;),
                     Value1 = c(12,43,54,34,23,77,44,22),
                     Value2 = c(6,5,2,7,5,6,4,3),
                     Lat = c(51.1, 51.6, 57.3, 52.4, 56.3, 54.3, 60.4, 49.2),
                     Lon = c(5, -3, -2, -1, 4, 3, -5, 0))
  data %&gt;%
    leaflet() %&gt;%
    addProviderTiles(providers$CartoDB.Positron) %&gt;%
    addCircles(lat=~Lat, lng=~Lon, radius = ~Value1*1000, group=c(~Name, &quot;Value1&quot;)) %&gt;%
    addCircles(lat=~Lat, lng=~Lon, radius = ~Value2, group=c(~Name, &quot;Value2&quot;)) %&gt;%
    addLayersControl(
      baseGroups = c(&quot;Value1&quot;, &quot;Value2&quot;),
      overlayGroups = c(&quot;A&quot;, &quot;B&quot;, &quot;C&quot;),
      options = layersControlOptions(collapsed = F)
    )
  </code></pre>
  <p><a href="https://i.stack.imgur.com/7PMfV.png" rel="nofollow noreferrer">Image: Output not what I expect</a></p>