Creating legend with circles leaflet R : <p>I'm trying to create a leaflet map with points sized by a variable. Is it possible to create a legend with different sized circles representing the different variable values? I found another post showing how to convert squares to circles in the legend, but am not sure how to change the size of different circles in the legend. </p>

<p>For example, here's a dummy script which creates 10 points associated with 2 classes of a variable (5 and 10). I'd like a legend with two circles the same size as that specified with addCircleMarkers with a radius of 5 and 10. If anyone can modify to create what I want I would be extremely grateful! Thanks!</p>

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

#create data
Points&lt;-data.frame(x=runif(10,20,21), y=runif(10,0,1), var=rep(c(5,10),5))
map = leaflet() %&gt;% addTiles()

# Set up shiny app
shinyApp(ui=bootstrapPage(
tags$style(type = "text/css", "html, body {width:100%;height:100%}",
".leaflet .legend i{
border-radius: 50%;
width: 10px;
height: 10px;
margin-top: 4px;
}
"
),
leafletOutput("myMap", width = "100%", height = "100%")),

server= function(input, output){

output$myMap = renderLeaflet({map %&gt;% 
    addCircleMarkers(Points$x,Points$y,radius=Points$var) %&gt;%
    addLegend(colors=rep("blue",2), labels=c(5,10))
  })
})
</code></pre>
