Currently it only specifies the geometry type for sf objects, which is not that useful or consistent with how it works for sp objects.
library(leaflet)
library(leafpop)
leaflet() %>%
addTiles() %>%
addCircleMarkers(data = breweries91,
popup = popupTable(breweries91))
breweries91 <- sf::st_as_sf(breweries91)
leaflet() %>%
addTiles() %>%
addCircleMarkers(data = breweries91,
popup = popupTable(breweries91))
A way to modify this might be that if it is an sf object, popupTable should relocate geometry to the last col and then default the zcol to be from cols 1 to the second to last col.
popup_data <- data %>%
dplyr::relocate(.data$geometry, .after = tidyselect::last_col())
popup <- leafpop::popupTable(popup_data, zcol = 1:ncol(popup_data) - 1)