U-boats in WW-II

[This article was first published on Wiekvoet, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This is the time when we celebrate the end of the second world war in The Netherlands, so I thought to do somwthig with data from that era. One of the things I enjoyed were books on the sea warfare, such as ‘The Cruel Sea’by Nicholas Monsarrat. In that book it was told that in 1943 the tide turned, and hence I started to look for data which could support that narrative.

Data

Data which I found are from www.uboat.net, a site with quite a lot of info on the topic. I extracted two data sets from the website, ships hit by U-boats and U-boats lost. In addition on wikipedia I found a table with ships lost, broken down by category. Wikipedia also has a good entry for the battle of the Atlantic.

Plots

The number of allied boats lost increases quite a lot in 1942. What happened is the USA entering the war, but having no protection against German U-boats. The second half of 1942 has technological advances for Germany. In 1943 to quote Wikipedia The Battle of the Atlantic was won by the Allies in two months. There was no single reason for this; what had changed was a sudden convergence of technologies, combined with an increase in Allied resources’. The figures show number of ships hit (data from uboat.net) and in Gross Registered Tons (GRT). The pattern is reasonable similar.

The counter plot is U-boats lost. Here wikipedia and uboat.net have slightly different numbers. What can be seen is an increase in losses in 1942. Then there is 1943 a big peak with over 40 U-boats lost.
To quote wikipedia: In all, 43 U-boats were destroyed in May, 34 in the Atlantic. This was 25% of German U-boat arm (U-Bootwaffe) (UBW)’s total operational strength. This was the turning point in the battle for the Atlantic.
Code
Sys.setlocale(category=’LC_TIME’,locale=’C’)
library(ggplot2)

# www.uboat.net
data1 <- read.delim(text=
‘year Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1939 2 5 1 1
1940 2 5 3 4 1 1 2 2 1 1 2 0
1941 0 0 5 2 1 4 0 4 2 2 5 10
1942 3 2 6 3 4 3 12 9 10 16 13 5
1943 7 18 16 16 40 17 38 24 11 26 19 7
1944 15 20 25 21 23 25 21 31 21 10 8 14
1945 11 22 27 52 22 ‘)
data1 <- reshape(data1,
    direction=’long’,
    varying=list(names(data1)[-1]),
    idvar=’year’,
    timevar=’month’,
    v.names=’Uboat’,
    times=names(data1)[-1])
data1$date <- as.Date(paste(data1$year,data1$month,'01',sep='-'),format='%Y-%b-%d')


data2 <- read.delim(text=
‘year Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1939 52 37 30 47
1940 58 54 26 11 17 66 43 66 64 72 36 50
1941 15 47 50 48 66 65 21 32 60 51 17 28
1942 66 82 99 89 146 146 109 131 116 120 142 76
1943 49 88 131 57 49 27 62 30 25 31 16 17
1944 20 28 22 12 17 22 25 37 15 10 11 25
1945 24 24 21 23 6
‘)
data2 <- reshape(data2,
    direction=’long’,
    varying=list(names(data2)[-1]),
    idvar=’year’,
    timevar=’month’,
    v.names=’Convoy’,
    times=names(data2)[-1])
data2$date <- as.Date(paste(data2$year,data2$month,'01',sep='-'),format='%Y-%b-%d')

both <- merge(data1,data2)
both <- both[order(both$date),]
both <- both[complete.cases(both),]
qplot(y=Convoy,
    x=date,
    data=both,
    geom=’line’,
    xlab=”,
    ylab=’Convoy ships hit’)
r2 <- read.delim(text=
‘Monthyear “Sunk by U-Boat” “Sunk by aircraft” “Sunk by warship or raider” “Sunk by mines” “German submarines lost”
Sep 1939 153879 0 5051 29537 2
Oct 1939 134807 0 32058 29490 5
Nov 1939 51589 0 1722 120958 1
Dec 1939 80881 2949 22506 82712 1
Jan 1940 111263 23693 0 77116 1
Feb 1940 169566 853 1761 54740 6
Mar 1940 62781 8694 0 35051 1
Apr 1940 32467 13409 5358 19799 5
May 1940 55580 158348 6893 47716 1
Jun 1940 284113 105193 61857 86087 0
Jul 1940 195825 70193 80796 33598 2
Aug 1940 267618 53283 63350 11433 3
Sep 1940 295335 56328 96288 8269 1
Oct 1940 352407 8752 32134 32548 1
Nov 1940 146613 66438 123671 46672 2
Dec 1940 212590 14890 55728 54331 0
Jan 1941 126782 78597 80796 17107 0
Feb 1941 196783 89305 89096 16507 0
Mar 1941 243020 113314 138906 23585 5
Apr 1941 249375 323454 91579 24888 2
May 1941 325492 146302 15002 23194 1
Jun 1941 310143 61414 17759 15326 4
Jul 1941 94209 9275 5792 8583 0
Aug 1941 80310 23862 24897 1400 4
Sep 1941 202820 40812 22910 14948 2
Oct 1941 156554 35222 3305 19737 2
Nov 1941 62196 23015 17715 1714 5
Dec 1941 124070 72850 6661 63853 10
Jan 1942 327357 57086 3275 10079 3
Feb 1942 476451 133746 0 7242 2
Mar 1942 537980 55706 25614 16862 6
Apr 1942 431664 82924 131188 15002 3
May 1942 607247 59041 19363 18795 4
Jun 1942 700235 54769 48474 19936 3
Jul 1942 476065 74313 54358 8905 11
Aug 1942 544410 60532 50516 0 9
Sep 1942 485413 57526 24388 0 10
Oct 1942 619417 5686 7576 5157 16
Nov 1942 729160 53868 19178 992 13
Dec 1942 330816 4853 12312 1618 4
Jan 1943 203128 25503 7040 18475 6
Feb 1943 359328 75 4858 34153 19
Mar 1943 627377 65128 0 884 15
Apr 1943 327943 3034 1742 11961 15
May 1943 264853 20942 0 1568 41
Jun 1943 97753 6083 17655 4334 17
Jul 1943 242145 106005 7176 72 37
Aug 1943 86579 14133 0 19 25
Sep 1943 118841 22905 9977 4396 10
Oct 1943 97407 22680 0 19774 26
Nov 1943 66585 62452 8538 6666 19
Dec 1943 86967 75471 0 6086 8
Jan 1944 92278 24237 6420 7176 16
Feb 1944 92923 21616 2085 0 20
Mar 1944 142944 0 7840 7176 25
Apr 1944 62149 19755 0 0 21
May 1944 24424 2873 0 0 24
Jun 1944 57875 9008 1812 24654 25
Jul 1944 63351 0 7219 8114 24
Aug 1944 98729 0 7176 7194 35
Sep 1944 43368 0 0 1437 22
Oct 1944 7176 0 0 4492 13
Nov 1944 29592 7247 1141 0 8
Dec 1944 58518 35920 0 35612 15
Jan 1945 56988 7176 2365 16368 14
Feb 1945 65233 7177 3899 18076 21
Mar 1945 65077 0 3968 36064 33
Apr 1945 72439 22822 0 8733 53
May 1945 11439 7176 0 0 35
‘)
r2$date <- as.Date(paste(r2$Monthyear,'01',sep='-'),format='%b %Y-%d')
qplot(y=Sunk.by.U.Boat,
    x=date,
    data=r2,
    geom=’line’,
    xlab=”,
    ylab=’Sunk by U Boat (GRT)’)

qplot(y=Uboat,
    x=date,
    data=both,
    geom=’line’,
    xlab=”,
    ylab=’U boats sunk’)+
    geom_line(aes(y=German.submarines.lost,x=date),data=r2)


To leave a comment for the author, please follow the link and comment on their blog: Wiekvoet.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)