War Data

A historical examination of American military deaths by conflict offers a quantitative insight into the scale and impact of these engagements. The data encapsulated here spans from the American Revolutionary War to the more recent Iraq War.

wars <- c('American Revolutionary War', 'War of 1812', 'Mexican-American War', 
          'Civil War (Union)', 'Civil War (Confederate)', 'Spanish-American War', 
          'World War I', 'World War II', 'Korean War', 'Vietnam War', 'Gulf War', 
          'War in Afghanistan', 'Iraq War')
deaths <- c(4435, 2260, 13283, 364511, 258000, 2446, 116516, 405399, 36574, 
            58220, 294, 2300, 4500)

# Create a data frame
war_data <- data.frame(wars, deaths)

Plotting

The following visualization provides a stark graphical representation of the data. Noteworthy is the significant variance in death tolls, reflecting the differing intensities and durations of these conflicts.

# Updated R code to use a single color for the bar plot and non-scientific notation for y-axis
p <- ggplot(war_data, aes(x=wars, y=deaths)) +
  geom_bar(stat="identity", fill="steelblue") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1), 
        plot.title = element_text(hjust = 0.5), 
        plot.subtitle = element_text(hjust = 0.5)) +
  labs(title="U.S. Military Deaths in Wars",
       subtitle="A Historical Perspective of American Combat Casualties",
       x="Conflict",
       y="Number of Deaths") +
  scale_y_continuous(labels=label_comma()) # Format y-axis labels with commas

# Display plot
print(p)