General Summary: This assignment aims to visualize the changes in the number of prisoners of war (POW) for Ukraine-War 2022. The dataset keeps track of POW count from the dates 2022-02-25 to 2022-04-06. The original dataset used for this assignment comes from Kaggle. Please click the link below for further information regarding the dataset.
Data Source Link (Hold CTRL + Click The Link):
Click Here for Data Source
#Import Packages
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.4 v dplyr 1.0.7
## v tidyr 1.1.4 v stringr 1.4.0
## v readr 2.1.0 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(zoo)
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(janitor)
##
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
library(viridis)
## Warning: package 'viridis' was built under R version 4.1.3
## Loading required package: viridisLite
library(ggdark)
## Warning: package 'ggdark' was built under R version 4.1.3
library(knitr)
# Import Packages
df = read.csv("russia_losses_personnel.csv")
#clean variable names
df = clean_names(df)
# Convert dat variable to date format
df$date = as.Date(df$date, format = "%m/%d/%Y")
#Create POW Number Change
df$pow_change = c(0,diff(df$pow))
# Cumulative Change
df%>%
ggplot(aes(date,pow, color = pow))+geom_line(size = 1.1)+geom_point(size = 2)+
labs(title = "Culminative Change in POW Over Time in the \n Ukraine 2022 War",
x = "Dates", y = "Prisoners of War Count")+
scale_color_viridis(option = "D")+dark_theme_gray()
## Inverted geom defaults of fill and color/colour.
## To change them back, use invert_geom_defaults().
#Absolute Change
df%>%
ggplot(aes(date,pow_change, color = pow_change))+geom_line(size = 1.1)+geom_point(size = 2)+
labs(title = "Absolute Change in POW Over Time in the \n Ukraine 2022 War",
x = "Dates", y = "Prisoners of War Count") +
scale_color_viridis(option = "D")+dark_theme_gray()
kable(df[,-c(3:4)])
| date | day | pow | pow_change |
|---|---|---|---|
| 2022-02-25 | 2 | 0 | 0 |
| 2022-02-26 | 3 | 0 | 0 |
| 2022-02-27 | 4 | 0 | 0 |
| 2022-02-28 | 5 | 0 | 0 |
| 2022-03-01 | 6 | 200 | 200 |
| 2022-03-02 | 7 | 200 | 0 |
| 2022-03-03 | 8 | 200 | 0 |
| 2022-03-04 | 9 | 200 | 0 |
| 2022-03-05 | 10 | 216 | 16 |
| 2022-03-06 | 11 | 232 | 16 |
| 2022-03-07 | 12 | 259 | 27 |
| 2022-03-08 | 13 | 284 | 25 |
| 2022-03-09 | 14 | 360 | 76 |
| 2022-03-10 | 15 | 371 | 11 |
| 2022-03-11 | 16 | 389 | 18 |
| 2022-03-12 | 17 | 389 | 0 |
| 2022-03-13 | 18 | 389 | 0 |
| 2022-03-14 | 19 | 389 | 0 |
| 2022-03-15 | 20 | 389 | 0 |
| 2022-03-16 | 21 | 389 | 0 |
| 2022-03-17 | 22 | 405 | 16 |
| 2022-03-18 | 23 | 405 | 0 |
| 2022-03-19 | 24 | 405 | 0 |
| 2022-03-20 | 25 | 405 | 0 |
| 2022-03-21 | 26 | 405 | 0 |
| 2022-03-22 | 27 | 411 | 6 |
| 2022-03-23 | 28 | 412 | 1 |
| 2022-03-24 | 29 | 412 | 0 |
| 2022-03-25 | 30 | 412 | 0 |
| 2022-03-26 | 31 | 412 | 0 |
| 2022-03-27 | 32 | 421 | 9 |
| 2022-03-28 | 33 | 421 | 0 |
| 2022-03-29 | 34 | 430 | 9 |
| 2022-03-30 | 35 | 430 | 0 |
| 2022-03-31 | 36 | 459 | 29 |
| 2022-04-01 | 37 | 459 | 0 |
| 2022-04-02 | 38 | 460 | 1 |
| 2022-04-03 | 39 | 460 | 0 |
| 2022-04-04 | 40 | 460 | 0 |
| 2022-04-05 | 41 | 467 | 7 |
| 2022-04-06 | 42 | 467 | 0 |