I am trying to make a map for my thesis of sampling sites of salamanders. I am super new to any of this so I don't really understand code much, but my advisor has given me a general outline of the code she has used before for something else that I am putting my stuff into. Where I am running into trouble is with the site markers for the types and their colors. I did manage to make an original map that I got to work but it only has frogs and salamanders, but I am trying to fix it to include toads and newts separately and with different colors.
Here is what I have been trying to do so far for the site markers on the map for each type of amphibian.
getColor <- ifelse(geocoded2$Type =="frog", "green")
ifelse(geocoded2$Type=="toad", "orange")
ifelse(geocoded2$Type=="salamander", "blue",
ifelse(geocoded2$Type=="newt", "purple"))
The error I am getting for these is:
Error in ifelse(geocoded2$Type == "frog", "green") :
argument "no" is missing, with no default
I got the map and legend to work, but just can't get the types to actually go through that are from my excel file Here is what I used for the map & legend:
# create the map
map <- leaflet(geocoded2) %>%
addProviderTiles(providers$Esri.OceanBasemap) %>%
#addTiles() %>% # use the default base map which is OpenStreetMap tiles
fitBounds(-165,90,165,-90)%>%
clearBounds()%>%
addAwesomeMarkers(~Long, ~Lat, icon=icons, label=~Type) %>%
addLegend("topright", colors= c("green", "blue", "red", "purple"), labels=c("Frog","Salamander", "toad", "Newt"), opacity=1 )
# plot the map
map