The American Civil War began in 1861 and the last battle was fought in 1865. Majority of the battles occurred along the east coast with the Confederates and the Union. This interactive leaflet allows users to explore the east coast battles during the Civil War. It also depicts which side won which battle, or whether it was inconclusive.
# libraries necessary for this project
library(leaflet)
library(sf)
library(tidyverse)
library(USAboundaries)
library(mapview)
civilwar <- read.csv("civilwar.csv")
civilwar_spat <- st_as_sf(civilwar, coords = c("Longitutde", "Latitude"), crs = 4326)
summary(civilwar_spat)
## OBJECTID Battle Other_Names Location_1
## Min. : 1.00 Length:374 Length:374 Length:374
## 1st Qu.: 94.25 Class :character Class :character Class :character
## Median :187.50 Mode :character Mode :character Mode :character
## Mean :187.50
## 3rd Qu.:280.75
## Max. :374.00
## State Campaign Principal_US_Commanders
## Length:374 Length:374 Length:374
## Class :character Class :character Class :character
## Mode :character Mode :character Mode :character
##
##
##
## Principal_CS_Commanders Forces_Engaged Description
## Length:374 Length:374 Length:374
## Class :character Class :character Class :character
## Mode :character Mode :character Mode :character
##
##
##
## Result_s_ CWSAC_Ref Preservation_Priority National_Park_Unit
## Length:374 Length:374 Length:374 Length:374
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## Start_Month Start_Day Start_Year End_Month
## Min. : 1.000 Min. : 1.00 Min. :1861 Min. : 1.000
## 1st Qu.: 4.000 1st Qu.: 8.00 1st Qu.:1862 1st Qu.: 5.000
## Median : 6.000 Median :16.00 Median :1863 Median : 7.000
## Mean : 6.746 Mean :15.99 Mean :1863 Mean : 6.794
## 3rd Qu.: 9.000 3rd Qu.:24.00 3rd Qu.:1864 3rd Qu.: 9.000
## Max. :12.000 Max. :31.00 Max. :1865 Max. :12.000
## End_Day End_Year Start_Date End_Date
## Min. : 1.00 Min. :1861 Length:374 Length:374
## 1st Qu.: 8.00 1st Qu.:1862 Class :character Class :character
## Median :16.00 Median :1863 Mode :character Mode :character
## Mean :15.72 Mean :1863
## 3rd Qu.:23.75 3rd Qu.:1864
## Max. :31.00 Max. :1865
## F__Days_Battle NPS_Site Battle_in_Multple_States_
## Min. : 1.000 Length:374 Length:374
## 1st Qu.: 1.000 Class :character Class :character
## Median : 1.000 Mode :character Mode :character
## Mean : 3.176
## 3rd Qu.: 2.000
## Max. :137.000
## Location_2 Location_3 Location_4 Total_Est__Casualties
## Length:374 Length:374 Mode:logical Length:374
## Class :character Class :character NA's:374 Class :character
## Mode :character Mode :character Mode :character
##
##
##
## US_Est__Casualties CS_Est__Casualties Est_Casualties
## Length:374 Length:374 Length:374
## Class :character Class :character Class :character
## Mode :character Mode :character Mode :character
##
##
##
## Casualties_in_Integers geometry
## Min. : 0.0 POINT :374
## 1st Qu.: 126.8 epsg:4326 : 0
## Median : 540.5 +proj=long...: 0
## Mean : 2299.4
## 3rd Qu.: 1821.0
## Max. :51000.0
leaflet(data = civilwar_spat) %>% # calls the leaflet function using the data civilwar_spat
addProviderTiles(providers$CartoDB) %>% # uses the basemap CartoDB
addCircleMarkers() # displays the civilwar_spat data as circle markers
civilwar_filtered <- civilwar_spat %>%
filter(State %in% c("VA", "NC", "SC", "FL", "GA", "MD", "PA")) # filter based on state abbreviations as theyre listed in the State variable
leaflet(data = civilwar_filtered) %>%
addProviderTiles(providers$CartoDB) %>%
addCircleMarkers()