Resolved personally.
library(leaflet)
library(dplyr)
Each icon was customized with numbers personally and was put into the working directory.
Then use icon_list()
# Create our own custom icons
icon_list <- iconList(
project1 = makeIcon("C:/Map/1.png", iconWidth = 24, iconHeight = 30),
project2 = makeIcon("C:/Map/2.png", iconWidth = 24, iconHeight = 30)
etc as many as you have
project1, project2 etc match the same names in the dataset column of course and in the dataset each project should have long and lat.
Then
data2 <- data %>% mutate(type = factor(data$project_id), c("project1",
"project2")
In server, the simple code will be something like this
m <- leaflet(data=data) %>%
addProviderTiles(providers$Stamen.TonerLite) %>%
addMarkers(~data2$long, ~data2$lat, icon=~icon_list[data2$project_id],
popup = state_popup)
Thanks to this question on stack overflow