Making our Map Pop
Similar to building a plot with ggplot2 or manipulating data with dplyr, your map needs to be stored in an object if you reference it later in your code.
Speaking of dplyr, the %>% operator can pipe data into the function chain that creates a leaflet map.
ipeds %>%
leaflet() %>%
addTiles() %>%
addCircleMarkers(popup = ~name, color = "#FF0000")
Piping makes our code more readable and allows us to refer to variables using the ~ operator rather than repeatedly specifying the data frame.
The color argument in addCircleMarkers() takes the name of a color or a hex code. For example, red or #FF0000.
map has been printed for you. Notice the circle markers are gone!
यह अभ्यास पाठ्यक्रम का हिस्सा है
Interactive Maps with leaflet in R
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Add circle markers with popups for college names
map %>%
addCircleMarkers(data = ca, radius = 2, popup = ___)