The goal of milRex is to make it easy to query military expenditure data from the Stockholm International Peace Research Institute. They offer the most up-to date, openly available data on military expenditure.
⚠️ Please verify a few data points of downloaded data with the SIPRI website to make sure that everything works, as this is currently under construction.⚠️ Please cite SIPRI when using the data and read the Sources and Methods section on their website concerning limitations linked below ⬇️.
You can install the development version of milRex from GitHub with:
# install.packages("devtools")
devtools::install_github("datapumpernickel/milRex")
This would query all the data, for military expenditure in constant USD.
library(milRex)
data <- sipri_get_data(indicator = "constantUSD",
cache = TRUE,
verbose = FALSE,
footnotes = FALSE)
The available indicators are:
sheet_name | indicator |
---|---|
Constant (2022) US$ | constantUSD |
Current US$ | currentUSD |
Share of GDP | shareOfGDP |
Share of Govt. spending | shareGovt |
Regional totals | regionalTotals |
Local currency financial years | currencyFY |
Local currency calendar years | currencyCY |
Per capita | perCapita |
all of the above | all |
Military Expenditure is a concept that is difficult to measure adequately in a comparative manner across the globe. The dataset by SIPRI is the best effort that exists today, using only open sources. Nonetheless, there is limitation to their data. I highly encourage anyone who wants to use this dataset, to read their Sources and Methods section here:
https://www.sipri.org/databases/milex/sources-and-methods
Some of the SIPRI estimates reported in their dataset are marked as uncertain or estimations (e.g. all the data for China). These cells are marked in blue or red in the resulting excel-file. Unfortunately, color coding is not machine-readable, hence this information cannot be translated into data.frames in R and is missing. Please be aware of this limitation.
The Stockholm International Peace Research Institute limits the copying and redistribution of its data to the following two use-cases:
- the excerption of SIPRI copyrighted material for such purposes as criticism, comment, news reporting, teaching, scholarship or research in which the use is for non-commercial purposes
- the reproduction of less than 10 per cent of a published data set.
Hence, this package does not contain any SIPRI data itself. It merely automatizes the access through the website, by making the corresponding POST request and cleaning the resulting xlsx file into tidy formats.
Please make sure to cite SIPRI when using their data with:
SIPRI Military Expenditure Database 2024, https://www.sipri.org/databases/milex
You can get a citation for the package with:
citation('milRex')