I have a large simple features dataset. The data has a column "url_1" containing the web address specific to each location. I would like to create a map from the sf object with a popup referencing the url for each location. I have succeeded in creating the link individually specifying each popup with coords and a url. While this works for 3 records, it is not realistic for my data. I'd appreciate any assistance.
Thanks
# Popup link reprex
library(dplyr)
library(sf)
# Create tibble
dat <- tibble(site = c("loc_1", "loc_2", "loc_3"),
url_1 = c("https://forum.posit.co/",
"https://cran.r-project.org/",
"https://rstudio.github.io/leaflet/"),
coord_x = c(1, 4, 8),
coord_y = c(3, 2, 6))
# Convert to sf
dat_sf <- st_as_sf(dat, coords = c("coord_x", "coord_y"))
# Create map with clickable link. This fails with error
mapview::mapview(dat_sf, popup = url)
# Create map with clickable link. This works but creates a single link for all records.
# I could specify coords and url for each record in popup argument (not efficient)
mapview::mapview(dat_sf, popup = '<a href = "https://rstudio.github.io/leaflet/"> Leaflet </a>')