#mapping section load the below libraries
library(ggplot2)
library(leaflet)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.0     ✔ readr     2.2.0
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ lubridate 1.9.5     ✔ tibble    3.3.1
## ✔ purrr     1.2.1     ✔ tidyr     1.3.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dplyr)

pelicount <- read.csv("/Users/pennybeaver/Library/Mobile Documents/com~apple~CloudDocs/COAST/Pelicount/Pelicount 2026.csv")

#convert lat and lon to numbers
pelicount$Latitude <- as.numeric(pelicount$Latitude)
library(htmltools)
library(glue)
label_text <- glue("<b>Number of Pelicans: <b> {pelicount$Count}<b>")

#create the final map
leaflet(pelicount) %>% addTiles() %>%
  addCircleMarkers(~Longitude, ~Latitude, clusterOptions = markerClusterOptions(),
                   radius = 5, color = "red", fillOpacity = 0.3, label = pelicount$Count, 
                   popup = label_text)
#Map of Australian pelican's counted in January 2026 for a citizen science project managed by COAST.You can scroll in and out and hover over purple points to get the number of pelicans counted in each location.