I am trying to implement opening url in a new tab when a particular state in a map is clicked in rstudio leaflet.
I see in the below link which talks about how to open url in a new tab once you click on something. But I want to implement the same in RStudio leaflet. Please help.
Below is the map code. Let me know if you need anymore information.
spdf <- rmapshaper::ms_simplify(usa_sf(), keep = 0.1)
pal <- colorNumeric("Blues", domain = spdf$pop_2014)
epsg2163 <- leafletCRS(
crsClass = "L.Proj.CRS",
code = "EPSG:2163",
proj4def = "+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs",
resolutions = 2^(16:7))
leaflet(spdf, options = leafletOptions(crs = epsg2163)) %>%
addPolygons(weight = 1, color = "#444444", opacity = 1,
fillColor = ~pal(pop_2014), fillOpacity = 0.7, smoothFactor = 0.5,
label = ~paste(name, pop_2014),
labelOptions = labelOptions(direction = "auto"))
JFYI: for installing albersusa package, refer this link: https://github.com/hrbrmstr/albersusa
Thanks a lot in advance. Looking forward to hear from someone.