Source: TBA
Get data from spreadsheet.
Link: https://docs.google.com/spreadsheets/d/1ajxXMyo-gClcmknxy2DxRNQ7ANE8KwJTNlsUuuH6Dp0/edit?gid=0#gid=0
Load libs.
library(stringr)
library(lubridate)
library(zoo)
Load data.
x <- read.table("tmpdat.tsv",sep="\t",header=TRUE,row.names=1)
x2 <- x[,seq(6,1749,2)]
tx <- t(x2)
rownames(tx) <- tx[,1]
tx <- tx[,2:ncol(tx)]
tmx <- apply(tx,2,as.numeric)
## Warning in apply(tx, 2, as.numeric): NAs introduced by coercion
rownames(tmx) <- rownames(tx)
head(tmx)
## Troops Planes Helicopters Tanks Artillery Armored personal carriers
## 26.2.2022 3500 14 8 102 15 536
## 27.2.2022 4300 27 26 146 49 706
## 28.2.2022 5300 29 29 191 74 816
## 1.3.2022 5710 29 29 198 77 816
## 2.3.2022 5840 30 31 211 85 862
## 3.3.2022 9000 30 31 217 90 900
## Mobile SRBM systems MLRS Boats Vehicles (+ fuel tanks) Fuel tanks UAV
## 26.2.2022 1 0 0 0 0 0
## 27.2.2022 0 5 2 30 60 2
## 28.2.2022 0 22 2 291 60 3
## 1.3.2022 0 22 2 291 60 3
## 2.3.2022 0 40 2 355 60 3
## 3.3.2022 0 42 2 374 60 3
## Anti-aircraft warfare Special equpment Submarines
## 26.2.2022 0 0 NA
## 27.2.2022 2 0 NA
## 28.2.2022 5 0 NA
## 1.3.2022 5 0 NA
## 2.3.2022 9 0 NA
## 3.3.2022 11 0 NA
tmx <- as.data.frame(tmx)
tmx$month <- sapply(strsplit(rownames(tmx),"\\."),"[[",2)
tmx$month <- str_pad(tmx$month, 2, pad = "0")
tmx$year <- sapply(strsplit(rownames(tmx),"\\."),"[[",3)
tmx$yearmonth <- paste(tmx$year,tmx$month)
tmx$month = tmx$year = tmx$Submarines = tmx$`Mobile SRBM systems` = NULL
head(tmx)
## Troops Planes Helicopters Tanks Artillery Armored personal carriers
## X26.2.2022 3500 14 8 102 15 536
## X27.2.2022 4300 27 26 146 49 706
## X28.2.2022 5300 29 29 191 74 816
## X1.3.2022 5710 29 29 198 77 816
## X2.3.2022 5840 30 31 211 85 862
## X3.3.2022 9000 30 31 217 90 900
## MLRS Boats Vehicles (+ fuel tanks) Fuel tanks UAV
## X26.2.2022 0 0 0 0 0
## X27.2.2022 5 2 30 60 2
## X28.2.2022 22 2 291 60 3
## X1.3.2022 22 2 291 60 3
## X2.3.2022 40 2 355 60 3
## X3.3.2022 42 2 374 60 3
## Anti-aircraft warfare Special equpment yearmonth
## X26.2.2022 0 0 2022 02
## X27.2.2022 2 0 2022 02
## X28.2.2022 5 0 2022 02
## X1.3.2022 5 0 2022 03
## X2.3.2022 9 0 2022 03
## X3.3.2022 11 0 2022 03
cur <- sapply(1:(ncol(tmx)-1),function(i) { x <- tmx[,i] ; diff(c(0, x)) } )
rownames(cur) <- rownames(tmx)
colnames(cur) <- colnames(tmx)[1:(ncol(tmx)-1)]
cur <- as.data.frame(cur)
cur$month <- sapply(strsplit(rownames(cur),"\\."),"[[",2)
cur$month <- str_pad(cur$month, 2, pad = "0")
cur$year <- sapply(strsplit(rownames(cur),"\\."),"[[",3)
cur$yearmonth <- paste(cur$year,cur$month)
cur$month = cur$year = cur$Submarines = cur$`Mobile SRBM systems` = NULL
head(cur)
## Troops Planes Helicopters Tanks Artillery Armored personal carriers
## X26.2.2022 3500 14 8 102 15 536
## X27.2.2022 800 13 18 44 34 170
## X28.2.2022 1000 2 3 45 25 110
## X1.3.2022 410 0 0 7 3 0
## X2.3.2022 130 1 2 13 8 46
## X3.3.2022 3160 0 0 6 5 38
## MLRS Boats Vehicles (+ fuel tanks) Fuel tanks UAV
## X26.2.2022 0 0 0 0 0
## X27.2.2022 5 2 30 60 2
## X28.2.2022 17 0 261 0 1
## X1.3.2022 0 0 0 0 0
## X2.3.2022 18 0 64 0 0
## X3.3.2022 2 0 19 0 0
## Anti-aircraft warfare Special equpment yearmonth
## X26.2.2022 0 0 2022 02
## X27.2.2022 2 0 2022 02
## X28.2.2022 3 0 2022 02
## X1.3.2022 0 0 2022 03
## X2.3.2022 4 0 2022 03
## X3.3.2022 2 0 2022 03
Aggregate by month.
agg <- aggregate(. ~ yearmonth, cur, sum)
rownames(agg) <- ym(agg$yearmonth)
agg$date <- ym(agg$yearmonth)
agg$tankrat <- agg$Troops / (agg$Tanks)
agg$tankratrm <- rollmean(agg$tankrat, 3,fill = list(NA, NULL, NA))
plot(agg$date,agg$tankrat,main="Troop:Tank Ratio",xlab="Date",ylab="Ratio",pch=19)
points(agg$date, agg$tankratrm,col="red",type="b",cex=0.5,pch=19)
agg$tankrat <- agg$Troops / ( agg$`Armored personal carriers`)
agg$tankratrm <- rollmean(agg$tankrat, 3,fill = list(NA, NULL, NA))
plot(agg$date,agg$tankrat,main="Troop:IFV Ratio",xlab="Date",ylab="Ratio",pch=19)
points(agg$date, agg$tankratrm,col="red",type="b",cex=0.5,pch=19)
agg$tankrat <- agg$Troops / ( agg$`Artillery`)
agg$tankratrm <- rollmean(agg$tankrat, 3,fill = list(NA, NULL, NA))
plot(agg$date,agg$tankrat,main="Troop:Artillery Ratio",xlab="Date",ylab="Ratio",pch=19)
points(agg$date, agg$tankratrm,col="red",type="b",cex=0.5,pch=19)