I am trying to show the data that I have in a data frame on a map by using leaflet library, but not sure how.
geom <- c('LINESTRING(174.7698950000 -41.3435950000,174.7698040000 -41.3434660000,174.7714690000 -41.3395070000)')
description <- c('labelA')
df <- data.frame(geom, description)
leaflet(df) %>%
addTiles() %>%
addPolylines(stroke = FALSE, smoothFactor = 0.3, fillOpacity = 1,
fillColor = factor('description'),
label = ~paste0('description', ": ", formatC(description, big.mark = ",")))
Error I am getting:
Error in polygonData.default(data) :
Don't know how to get path data from object of class data.frame
Please let me know how I can improve the question instead of down voting