library(leaflet)
## Warning: package 'leaflet' was built under R version 4.2.1
MO <- read.csv("C:\\Users\\matth\\OneDrive\\Documents\\R\\data\\FWW_MO.csv")
head(MO)
## Latitude Longitude Color Host ID Region
## 1 38.64899 -90.36710 R Birch MO-02 MO
## 2 38.64899 -90.36710 R Ailanthus MO-03 MO
## 3 37.20338 -91.87650 R Persimmon St03 RH MO MO
## 4 39.20722 -94.67278 B Elm Sample 04 BH MO MO
## 5 37.20338 -91.87650 R Persimmon St05 RH MO MO
## 6 39.18111 -94.67028 B Elm Sample 05 BH MO MO
length(MO$ID)
## [1] 32
table(MO$Region)
##
## MO
## 32
m <- leaflet(MO) %>%
setView(lng =-96.69 , lat = 35.72, zoom = 4)
m %>%
addTiles()
pal <- colorFactor(c("black", "red"), domain = c("R", "B"))
m %>%
addProviderTiles(
#providers$Stamen.Terrain) %>%
providers$CartoDB.Positron) %>%
addCircleMarkers(radius = 1,
color = ~pal(Color),
popup = ~ID)
## Assuming "Longitude" and "Latitude" are longitude and latitude, respectively
DNA <- read.csv("C:\\Users\\matth\\OneDrive\\Documents\\R\\maps\\FWW_DNA_Samples.csv")
head(DNA)
## Latitude Longitude Color Host ID Region
## 1 40.56599 -105.1546 R Elm LR 2016-9 CO
## 2 40.54871 -105.1353 R CC LR 2016-12 CO
## 3 40.51962 -105.1480 R apple LR 2016-6w2 CO
## 4 40.09828 -105.3021 R CC KL34 CO
## 5 40.00365 -105.3636 R CC KL-3 CO
## 6 39.66747 -105.2588 R NLCW J89 CO
length(DNA$ID)
## [1] 89
table(DNA$Region)
##
## CO CT MA MD MO OH
## 10 9 14 20 15 21
map <- leaflet(DNA) %>%
setView(lng =-96.69 , lat = 35.72, zoom = 4)
map %>%
addTiles()
pal <- colorFactor(c("black", "red"), domain = c("R", "B"))
map %>%
addProviderTiles(
#providers$Stamen.Terrain) %>%
#providers$Esri.NatGeoWorldMap) %>%
#providers$Esri.WorldTopoMap) %>%
providers$CartoDB.Positron) %>%
addCircleMarkers(radius = 1,
color = ~pal(Color),
popup = ~ID) %>%
addScaleBar(
position = ("bottomleft"))
## Assuming "Longitude" and "Latitude" are longitude and latitude, respectively