library(leaflet)
library(tidyverse)
data <- read_csv('allplaces.csv')
# Define color and size based on the 'Won' column
color <- ifelse(data$Won == "Yes", "#A13935", "grey")
size <- ifelse(data$Won == "Yes", 20, 10)
circle_data = filter(data,Won=='No')
icon_data = filter(data,Won=='Yes')
# Create the leaflet map
m <- leaflet() %>%
addTiles() %>%
setView(lng = -95.7129, lat = 37.0902, zoom = 4) %>%
addCircleMarkers(
data=circle_data,
lng = ~Longitude,
lat = ~Latitude,
color = 'grey',
radius = 10,
popup = paste(circle_data$Name,"-",circle_data$Year),
fillOpacity = .7, # Set the transparency level
fill = TRUE) %>%
addMarkers(
data=icon_data,
icon=icons(iconUrl='https://www.bestrestroom.com/wp-content/themes/cintas-best-bathroom/img/best-restroom-logo.png',
iconWidth=50,iconHeight=50),
lng = ~Longitude,
lat = ~Latitude,
popup = paste(icon_data$Name,"-",icon_data$Year))
# Display the map
m