I'm trying to re-appropriate a Leaflet code I used six months ago, with which I had no problem at the time. I haven't used Leaflet since then and am now no longer able to generate maps like I was before.
Simply put, after switching out the variables in the same way I have for many other maps 6 months ago, I am receiving the following error message and am not sure how to fix it: Error in mutate_impl(.data, dots) : object 'address.lon' not found
I loaded the appropriate packages and data formats. Basic troubleshooting has been addressed. How do I fix this?
The contextual code is the following:
Example Data
org dept address latitude longitude
ABC, Inc., SPSG, 111111 North Whatever Houston, TX 77058, 29.5431888, -95.1023828
DEF, Inc., Security Systems, 111 North Sepulveda boulevard 2000 El Segundo, CA 90245, 42.6379953, -71.2459721
df %>%
mutate(popup_info=paste(sep = "<br/>", paste0("<b>","<i>", org,"<i>", "</b>"), dept)) %>%
filter(!is.na(longitude) & !grepl("CLOSED", org)) %>%
filter(!is.na(latitude) & !grepl("CLOSED", org)) -> df1
## Plot the Maps
# Client Map
orgpal <- colorFactor(plasma(7), df1$org)
leaflet(df1) %>%
addProviderTiles("CartoDB.Positron") %>%
addCircleMarkers(lng = ~longitude,
lat = ~latitude,
radius = 2.5,
fillColor = ~orgpal(orgpal),
stroke=FALSE,
fillOpacity = 1,
popup = ~popup_info) %>%
addLegend("bottomright", pal = orgpal, values = ~org, labels = "Organization", title = "Client Locations") %>%
addMiniMap(tiles = providers$CartoDB.PositronNoLabels, width = 120, height=80)
Am I misunderstanding the function of address.lon? I apologize if my lack of understanding of coding prevents me from seeing an easy fix, I just haven't interacted with this code in a while. I appreciate any help I can receive.