Publications by Anthony B. Masters
ONS COVID-19 Model Estimates
Purpose The purpose of this R Markdown document is to create an animated graph. That graph will focus how the model estimates of COVID-19 incidence in England have revised over time. The Office for National Statistics COVID-19 Infection Survey is published weekly. The ONS published the latest survey estimates on 4th December 2020. Install packag...
597 sym R (1935 sym/5 pcs) 1 img
SA PowerBall Lottery
Purpose The purpose of this R Markdown document is to calculate probabilities of a numerical sequence in the South African PowerBall lottery. Packages and Themes First, we install the tidyverse set of packages: library(tidyverse) Next, we set the plotting theme for the graphs: theme_clean <- theme_bw(base_family="Calibri") + theme(legend.posi...
476 sym R (2051 sym/6 pcs) 1 img
PHE Coronavirus Package ukcovid19
Purpose This R Markdown document shows how to draw data with the ukcovid19 package. This data can be used to create graphs or repeatable analyses. The developer’s guide from Public Health England is on the main COVID-19 dashboard. Public Health England also have a GitHub page about the API service. Packages and themes First, we load our requir...
962 sym R (2803 sym/8 pcs) 1 img
Newcomb-Benford Distributions
Purpose This R Markdown document analyses results from the 2020 US Presidential election. That analysis looks at vote counts in Chicago precincts. The electoral data can be downloaded from the Chicago Board of Election Commissioners website. Packages and themes First, we install the packages we need: library(tidyverse) library(stringr) library(r...
1106 sym R (4221 sym/18 pcs) 3 img
Data Manipulation in Base R and Tidyverse
Purpose The purpose of this code is to compare Base R and tidyverse code for data manipulation. This is using the standard iris data-set. There is a sheet for data manipulation in the tidyverse. Install packages First, we load the tidyverse package. library(tidyverse) Counting a single value. Suppose we wanted to count the number of Setosa spec...
1642 sym R (1766 sym/16 pcs)
Coronavirus Deaths by Data Source - 2021-01-30
Purpose The purpose of this code is to create graphs comparing two different COVID-19 death measures by date of death. The first measure is death registrations from the Office for National Statistics. This analysis uses the data file for registrations up to 15th January 2021. The second measure is confirmed deaths from Public Health England (who ...
1403 sym R (5172 sym/13 pcs) 2 img
One Hundred Thousand
Purpose The purpose of this R Markdown document is to produce graphs with 10,000 and 100,000 dots. This concerns the perception of small probabilities. Packages and Themes First, I install the packages we need. library(tidyverse) library(patchwork) Next, I set the plotting theme. theme_clean3 <- theme_bw(base_family="Gill Sans Nova") + theme(...
590 sym R (2258 sym/9 pcs) 2 img
COVID-19 Hospital Phase Graphs
Purpose The purpose of this code is to create graphs showing COVID-19 admissions and patients over time. This code will use Public Health England’s R package. Packages and Themes Depending on your version of R, you may need to use remotes to install the necessary packages. library(remotes) remotes::install_github("publichealthengland/coronavir...
1051 sym R (3982 sym/11 pcs) 2 img
ONS Mortality Rates
Purpose This R code generates two graphs, concerning death registrations and mortality rates in England and Wales. The underlying data source is an ad hoc spreadsheet from the Office for National Statistics. One of these graphs is two graphs side by side, using Thomas Lin Pederson’s patchwork package. Packages and themes First, I install the p...
1482 sym R (6186 sym/15 pcs) 3 img
ONS Beta API (Labour Market)
Purpose The purpose of this R Markdown document is to draw an employment time series from the Office for National Statistics beta interface. I also show how to draw the same data frame from their equivalent flat file. Packages and themes First, I install the packages we need: library(httr) library(jsonlite) library(tidyverse) library(readxl) lib...
1270 sym R (3645 sym/12 pcs) 1 img