Package 'troopdata'

Title: Tools for Analyzing Cross-National Military Deployment and Basing Data
Description: These functions generate data frames on troop deployments and military basing using U.S. Department of Defense data on overseas military deployments. This package provides functions for pulling country-year troop deployment and basing data. Subsequent versions will hopefully include cross-national data on deploying countries.
Authors: Michael Flynn [aut, cre] (ORCID: <https://orcid.org/0000-0002-6064-740X>)
Maintainer: Michael Flynn <[email protected]>
License: GPL (>= 3)
Version: 1.0.4.9000
Built: 2026-06-02 18:44:50 UTC
Source: https://github.com/meflynn/troopdata

Help Index


Tools for Analyzing Cross-National Military Deployment and Basing Data

Description

Generate customized data frames containing U.S. military deployment data

Details

The troopdata package contains functions for generating customized data sets on U.S. military deployment data and U.S. overseas basing data. The data contain country identifiers that can be used to merge these data with other data to analyze trends in the United States' overseas military posture.

Author(s)

Michael E. Flynn [email protected]

References

https://www.m-flynn.com/ https://github.com/meflynn/troopdata

See Also

Useful links:


Vine's U.S. basing data

Description

basedata returns a data frame containing David Vine's US basing data.

Usage

basedata

Format

A data frame with country-base observations including the following variables:

countryname

A character vector of country names.

ccode

A numeric vector of Correlates of War country codes.

iso3c

A character vector of ISO three character country codes.

basename

Name of the facility.

lat

The facility's latitude.

lon

The facility's longitude.

base

Binary indicator identifying the facility as a major base or not.

lilypad

A binary indicator identifying the facility as a lilypad or not. Vine codes lilypads as less than 200 personnel or "other site" designation in Pentagon reports.

fundedsite

A binary variable indicating whether or not the facility is a host-state base funded by the US.

Value

Returns the full data frame containing country observations of US military bases from the Cold War period through 2018.

Source

https://aura.american.edu/articles/online_resource/Lists_of_U_S_Military_Bases_Abroad_1776-2020/23856486


U.S. Military overseas construction spending data

Description

builddata returns a data frame containing geocoded location-project-year overseas military construction spending data.

Usage

builddata

Format

A data frame with country-base observations including the following variables:

countryname

A character vector of country names.

ccode

A numeric vector of Correlates of War country codes.

year

Year of observed country-year spending.

iso3c

A character vector of ISO three character country codes.

location

Name of the facility where spending occurred, or host country where detailed facility information is unavailable.

spend_construction

Total obligational authority associated with the observed location-year in thousands of current US dollars.

lat

The facility's latitude.

lon

The facility's longitude.

Value

Returns the full data frame containing location-project-year observations of U.S. military construction spending data from 2008-2019.


Function to retrieve customized U.S. basing data

Description

get_basedata() generates a customized data frame containing data obtained from David Vine's U.S. basing data.

Usage

get_basedata(host = NA, country_count = FALSE, groupvar = NULL)

Arguments

host

The Correlates of War (COW) numeric country code or ISO3C code for the host country or countries in the series

country_count

Logical. Should the function return a country-level count of the total number of bases or the country-site data

groupvar

A character string indicating how country count totals should be generated. Accepted values are 'countryname', 'ccode', or 'iso3c'. Can take on Required when using country_count argument.

Details

Our research team updated these data through 2018.

Value

get_basedata() returns a data frame containing information on U.S. military bases present within selected host countries. This can be customized to include country-base observations or country-count observations.

Author(s)

Michael E. Flynn

References

David Vine. 2015. Base Nation. Metropolitan Books. New York, NY.

Examples

## Not run: 
library(tidyverse)
library(troopdata)

example <- get_basedata(host = NA)

head(example)


## End(Not run)

Function to retrieve customized U.S. construction spending data.

Description

get_builddata() generates a customized data frame containing location-project-year observations of U.S. military construction and housing spending in thousands of current dollars.

Usage

get_builddata(host = NA, startyear, endyear)

Arguments

host

The Correlates of War (COW) numeric country code or ISO3C code for the host country or countries in the series

startyear

The first year for the series

endyear

The last year for the series

Value

get_builddata() returns a data frame containing location-project-year observations of U.S. military construction and housing spending in thousands of current dollars.

Author(s)

Michael E. Flynn

References

Michael A. Allen, Michael E. Flynn, and Carla Martinez Machain. 2020. "Outside the wire: US military deployments and public opinion in host states." American Political Science Review. 114(2): 326-341.

Examples

## Not run: 
library(tidyverse)
library(troopdata)

example <- get_builddata(host = NA, startyear = 2008, endyear = 2019)

head(example)


## End(Not run)

Function to retrieve customized multilateral military exercise data

Description

get_exercises() generates a customized data frame containing exercise-country-year observations of multilateral military exercises. Users can subset the data by participating country, year, exercise duration, geographic location, exercise name, the domain(s) of the exercise (e.g., air, land, sea), the mission focus (warfighting, humanitarian, peacekeeping), and the number of participating countries.

Usage

get_exercises(
  country = NULL,
  startyear = NULL,
  endyear = NULL,
  min_duration = NULL,
  max_duration = NULL,
  location = NULL,
  exercise_name = NULL,
  domain = NULL,
  focus = NULL,
  min_participants = NULL,
  max_participants = NULL
)

Arguments

country

The Gleditsch and Ward (G&W) numeric country code or country name for the participating country or countries to include. Numeric input is matched exactly against the gwcode column. Character input is matched against the country column using a case-insensitive grepl fuzzy match, so partial names are accepted (e.g., "korea" returns both Koreas). Multiple values can be supplied as a vector. The default is NULL, which returns all participating countries.

startyear

The first year for the series. The default is set to the minimum year in the currently published data.

endyear

The last year for the series. The default is the maximum year in the currently published data.

min_duration

Numeric. Minimum exercise duration in days (inclusive). Default is NULL (no minimum filter).

max_duration

Numeric. Maximum exercise duration in days (inclusive). Default is NULL (no maximum filter).

location

Character. A string or vector of strings used to subset exercises by geographic location. Matched against the Location column with a case-insensitive grepl fuzzy match. Default is NULL.

exercise_name

Character. A string or vector of strings used to subset exercises by name. Matched against both the Ex_Name and Series_Name columns with a case-insensitive grepl fuzzy match (e.g., "cobra" matches "Cobra Gold"). Default is NULL.

domain

Character. A string or vector of strings indicating one or more exercise domains (warfighting environments) to include. Accepted values are "air", "land", "sea", "amphibious", and "cyber". Matching is case-insensitive. An exercise is returned if it is flagged for any of the supplied domains (logical OR). Default is NULL, which returns all domains.

focus

Character. A string or vector of strings indicating one or more mission focuses to include. Accepted values are "warfighting", "humanitarian", and "peacekeeping". Matching is case-insensitive. An exercise is returned if it is flagged for any of the supplied focuses (logical OR). Default is NULL, which returns all mission focuses.

min_participants

Numeric. Minimum number of participating countries in the exercise (inclusive). Default is NULL (no minimum filter).

max_participants

Numeric. Maximum number of participating countries in the exercise (inclusive). Default is NULL (no maximum filter).

Value

get_exercises() returns a data frame containing exercise-country-year observations of multilateral military exercises that match the specified filter criteria.

Author(s)

Michael E. Flynn

References

D'Orazio, Vito; Galambos, Kevin, 2021, "Multinational Military Exercises, 1980-2010", https://doi.org/10.7910/DVN/KHFODX, Harvard Dataverse, V1.

Gleditsch, Kristian S., and Michael D. Ward. 1999. "Interstate System Membership: A Revised List of the Independent States since 1816." International Interactions 25(4): 393-413.

Examples

## Not run: 
library(tidyverse)
library(troopdata)

# Pull all exercises that include South Korea between 2000 and 2015.
korea_exercises <- get_exercises(country = "korea",
                                 startyear = 2000,
                                 endyear = 2015)

# Pull all naval and amphibious exercises lasting at least 5 days.
sea_exercises <- get_exercises(domain = c("sea", "amphibious"),
                               min_duration = 5)

# Pull all "Cobra Gold" exercises in Thailand.
cobra_gold <- get_exercises(exercise_name = "cobra gold",
                            location = "thailand")

# Pull large-scale humanitarian exercises (10 or more participants).
large_hadr <- get_exercises(focus = "humanitarian",
                            min_participants = 10)

## End(Not run)

Function to retrieve customized U.S. troop deployment data

Description

get_troopdata() generates a customized data frame containing country-year observations of U.S. military deployments overseas.

Usage

get_troopdata(
  host = NULL,
  branch = FALSE,
  startyear = 1950,
  endyear = 2025,
  quarters = FALSE,
  guard_reserve = FALSE,
  civilians = FALSE,
  state_data = FALSE,
  reports = FALSE
)

Arguments

host

The Correlates of War (COW) numeric country code, ISO3C code, or country name, for the host country or countries in the series. If region == TRUE the user can specify a COW region name and the function will try to match it to the region column in the data. The default is NA.

branch

Logical. Should the function return a single vector containing total troop values or multiple vectors containing total values and values for individual branches? Default is FALSE.

startyear

The first year for the series. The default is set to 1950.

endyear

The last year for the series. The default is the maximum year in the currently published data.

quarters

Logical. Should the function return quarterly data? Default is FALSE.

guard_reserve

Logical. Should the function return values for the National Guard and Reserve? Default is FALSE.

civilians

Logical. Should the function return values for civilian DoD personnel? Default is FALSE.

state_data

Logical. Should the function return disaggregated data on US States? Default is FALSE.

reports

Logical. Should the function return reports for the specified countries and years? Default is FALSE.

Value

get_troopdata() returns a data frame containing country-year observations for U.S. troop deployments.

Author(s)

Michael E. Flynn

References

Tim Kane. Global U.S. troop deployment, 1950-2003. Technical Report. Heritage Foundation, Washington, D.C.

Michael A. Allen, Michael E. Flynn, and Carla Martinez Machain. 2022. "Global U.S. military deployment data: 1950-2020." Conflict Management and Peace Science. 39(3): 351-370.

Examples

## Not run: 
library(tidyverse)
library(troopdata)

example <- get_troopdata(host = "United States",
                        branch = TRUE,
                        startyear = 1980,
                        endyear = 2015)

head(example)


## End(Not run)

Multilateral Military Exercises (MME) data, long format

Description

mme_long returns a data frame containing exercise-country-year observations of multilateral military exercises. Built from the MME version 7 data (https://doi.org/10.7910/DVN/KHFODX) and reshaped so each row represents a single participating country in a single year of a single exercise. This is the data object underlying get_exercises().

Usage

mme_long

Format

A data frame with exercise-country-year observations including the following variables:

MMEID

Unique exercise identifier from the MME source data.

Ex_Name

The name of the individual exercise (e.g., "Cobra Gold 23").

Series_Name

The name of the broader exercise series the exercise belongs to (e.g., "Cobra Gold").

gwcode

Numeric Gleditsch and Ward country code for the participating country. Looked up from country via the countrycode package; NA for non-country participants such as "NATO" or regional groupings.

country

Character vector of participating country names as recorded in the MME source data.

year

The year of the observation. Exercises spanning multiple years are expanded so that each year between s.year and e.year produces its own row.

Location

The geographic location where the exercise was held (free-text from the source data).

lat

Latitude of the exercise location.

lon

Longitude of the exercise location.

StartDate

Original start-date string from the source data.

s.year

Numeric year the exercise began.

s.month

Numeric month the exercise began.

s.day

Numeric day the exercise began (may be "xx" when unknown).

EndDate

Original end-date string from the source data.

e.year

Numeric year the exercise ended.

e.month

Numeric month the exercise ended.

e.day

Numeric day the exercise ended (may be "xx" when unknown).

CPX

Binary indicator: command post exercise.

Air

Binary indicator: air domain.

Land

Binary indicator: land domain.

Sea

Binary indicator: sea domain.

Amphibious

Binary indicator: amphibious domain.

Cyber

Binary indicator: cyber domain.

Warfighting

Binary indicator: warfighting focus.

Peacekeeping

Binary indicator: peacekeeping focus.

Humanitarian

Binary indicator: humanitarian focus.

FocusDescription

Free-text description of the exercise's focus from the source data.

AdditionalParticipantInfo

Free-text notes about participants from the source data.

participant_count

Total number of participating countries in the exercise. The same value is repeated across all rows that share an MMEID. Used by the min_participants and max_participants arguments of get_exercises().

Value

Returns the full data frame of exercise-country-year observations of multilateral military exercises from 1980 forward.

Source

D'Orazio, Vito; Galambos, Kevin, 2021, "Multinational Military Exercises, 1980-2010", doi:10.7910/DVN/KHFODX, Harvard Dataverse, V1.


U.S. overseas troop deployment data

Description

troopdata returns a data frame containing information on US military deployments.

Usage

troopdata_rebuild_long

Format

A data frame with country year observations including the following variables:

ccode

A numeric vector of Correlates of War country codes.

iso3c

A character vector of ISO three character country codes.

countryname

A character vector of country names.

region

Correlates of War geographic region name.

year

The year of the observation.

month

The month of the observation.

quarter

The quarter of the observation.

year_quarter

The year and quarter of the observation.

source

The DMDC report source of the observation.

troops_ad

The total number of active duty US military personnel deployed to the host country.

troops_all

The total number of US military personnel deployed to the host country including guard and reserve.

army_ad

Total number of active duty Army personnel deployed to the host country.

navy_ad

Total number of active duty Navy personnel deployed to the host country.

air_force_ad

Total number of active duty Air Force personnel deployed to the host country.

space_force_ad

Total number of active duty Space Force personnel deployed to the host country.

marine_corps_ad

Total number of Marine Corps personnel deployed to the host country.

coast_guard_ad

Total number of Coast Guard personnel deployed to the host country.

total_selected_reserve

Total number of reserve US military personnel deployed to the host country.

army_reserve

Total number of reserve Army personnel deployed to the host country.

navy_reserve

Total number of reserve Navy personnel deployed to the host country.

air_force_reserve

Total number of reserve Air Force personnel deployed to the host country.

marine_corps_reserve

Total number of reserve Marine Corps personnel deployed to the host country.

coast_guard_reserve

Total number of reserve Coast Guard personnel deployed to the host country.

army_national_guard

Total number of Army National Guard personnel deployed to the host country.

air_national_guard

Total number of Air National Guard personnel deployed to the host country.

army_civilian

Total number of Army civilian personnel deployed to the host country.

navy_civilian

Total number of Navy civilian personnel deployed to the host country.

air_force_civilian

Total number of Air Force civilian personnel deployed to the host country.

marine_corps_civilian

Total number of Marine Corps civilian personnel deployed to the host country.

dod_civilian

Total number of Department of Defense civilian personnel deployed to the host country.

total_civilian

Total number of civilian personnel deployed to the host country.

Value

Returns the full data frame containing observations of US military deployments to overseas locations (countries and territories) from 1950 through 2024.

Source

https://www.heritage.org/defense/report/global-us-troop-deployment-1950-2005

doi:10.1177/07388942211030885


DMDC Deployment Reports

Description

troopdata_rebuild_reports returns a data frame containing DMDC reports on US military deployments.

Usage

troopdata_rebuild_reports

Format

A data frame with country year quarter observations including the following variables:

ccode

A numeric vector of Correlates of War country codes.

iso3c

A character vector of ISO three character country codes.

countryname

A character vector of country names.

region

Correlates of War geographic region name.

year

The year of the observation.

month

The month of the observation.

quarter

The quarter of the observation.

source

The DMDC report source of the observation.

Location

The geographic location listed in the DMDC reports.

Total

"Total number of US military personnel deployed to the host country.

Total Ashore

"Total number of US military personnel deployed to the host country, excluding those at sea.

Total Afloat

"Total number of US military personnel deployed to the host country, at sea.

Army Total

Total number of Army personnel deployed to the host country.

Navy Ashore

Total number of Navy personnel deployed to the host country, excluding those at sea.

Navy Temporary Ashore

Total number of Navy personnel deployed to the host country, temporarily.

Navy Other

Total number of Navy personnel deployed to the host country, in other capacities.

Marine Corps Ashore

Total number of Marine Corps personnel deployed to the host country, excluding those at sea.

Marine Corps Afloat

Total number of Marine Corps personnel deployed to the host country, at sea.

Air Force Total

Total number of Air Force personnel deployed to the host country.

Navy Afloat

Total number of Navy personnel deployed to the host country, at sea.

Navy Total

Total number of Navy personnel deployed to the host country.

Marine Corps Total

Total number of Marine Corps personnel deployed to the host country.

troops_ad

The total number of active duty US military personnel deployed to the host country.

army_ad

Total number of active duty Army personnel deployed to the host country.

navy_ad

Total number of active duty Navy personnel deployed to the host country.

marine_corps_ad

Total number of active duty Marine Corps personnel deployed to the host country.

space_force_ad

Total number of active duty Space Force personnel deployed to the host country.

air_force_ad

Total number of active duty Air Force personnel deployed to the host country.

coast_guard_ad

Total number of Coast Guard personnel deployed to the host country.

Macro Location

The geographic location listed in the DMDC reports.

Army Active Duty

Total number of active duty Army personnel deployed to the host country.

Navy Active Duty

Total number of active duty Navy personnel deployed to the host country.

Marine Corps Active Duty

Total number of active duty Marine Corps personnel deployed to the host country.

Air Force Active Duty

Total number of active duty Air Force personnel deployed to the host country.

Coast Guard Active Duty

Total number of active duty Coast Guard personnel deployed to the host country.

Space Force Active Duty

Total number of active duty Space Force personnel deployed to the host country.

Total Active Duty

Total number of active duty US military personnel deployed to the host country.

Army National Guard

Total number of Army National Guard personnel deployed to the host country.

Army Reserve

Total number of reserve Army personnel deployed to the host country.

Navy Reserve

Total number of reserve Navy personnel deployed to the host country.

Marine Corps Reserve

Total number of reserve Marine Corps personnel deployed to the host country.

Air National Guard

Total number of Air National Guard personnel deployed to the host country.

Air Force Reserve

Total number of reserve Air Force personnel deployed to the host country.

Coast Guard Reserve

Total number of reserve Coast Guard personnel deployed to the host country.

Total Selected Reserve

Total number of reserve US military personnel deployed to the host country.

Army Civilian

Total number of Army civilian personnel deployed to the host country.

Navy Civilian

Total number of Navy civilian personnel deployed to the host country.

Marine Corps Civilian

Total number of Marine Corps civilian personnel deployed to the host country.

Air Force Civilian

Total number of Air Force civilian personnel deployed to the host country.

DOD Civilian

Total number of Department of Defense civilian personnel deployed to the host country.

Total Civilian

Total number of civilian personnel deployed to the host country.

Grand Total

Total number of US military and civilian personnel deployed to the host country.

Value

Returns a data frame containing DMDC reports of US military deployments to overseas locations from 1950 through 2024.

Source

https://www.heritage.org/defense/report/global-us-troop-deployment-1950-2005

doi:10.1177/07388942211030885


U.S. domestic troop deployment data, by state

Description

troopdata_rebuild_us_states returns a data frame containing information on U.S. military personnel stationed in each of the 50 U.S. states (and U.S. territories where reported). Returned by get_troopdata() when the state_data argument is set to TRUE.

Usage

troopdata_rebuild_us_states

Format

A data frame with state-year (and state-year-quarter) observations including the following variables:

fipscode

A numeric vector of U.S. Federal Information Processing Standards (FIPS) state codes. Used as the numeric identifier when subsetting via get_troopdata(host = <numeric>, state_data = TRUE).

state

A character vector of U.S. state names. Matched with a case-insensitive grepl fuzzy match when subsetting via get_troopdata(host = <character>, state_data = TRUE).

year

The year of the observation.

month

The month of the observation.

quarter

The quarter of the observation.

troops_ad

The total number of active duty US military personnel stationed in the state.

army_ad

Total number of active duty Army personnel stationed in the state.

navy_ad

Total number of active duty Navy personnel stationed in the state.

air_force_ad

Total number of active duty Air Force personnel stationed in the state.

marine_corps_ad

Total number of active duty Marine Corps personnel stationed in the state.

coast_guard_ad

Total number of active duty Coast Guard personnel stationed in the state.

space_force_ad

Total number of active duty Space Force personnel stationed in the state.

army_national_guard

Total number of Army National Guard personnel stationed in the state.

air_national_guard

Total number of Air National Guard personnel stationed in the state.

army_reserve

Total number of Army Reserve personnel stationed in the state.

navy_reserve

Total number of Navy Reserve personnel stationed in the state.

marine_corps_reserve

Total number of Marine Corps Reserve personnel stationed in the state.

air_force_reserve

Total number of Air Force Reserve personnel stationed in the state.

coast_guard_reserve

Total number of Coast Guard Reserve personnel stationed in the state.

total_selected_reserve

Total number of reserve US military personnel stationed in the state.

army_civilian

Total number of Army civilian personnel stationed in the state.

navy_civilian

Total number of Navy civilian personnel stationed in the state.

air_force_civilian

Total number of Air Force civilian personnel stationed in the state.

marine_corps_civilian

Total number of Marine Corps civilian personnel stationed in the state.

dod_civilian

Total number of Department of Defense civilian personnel stationed in the state.

total_civilian

Total number of civilian personnel stationed in the state.

Value

Returns the full data frame containing state-year (and state-year-quarter) observations of U.S. military personnel stationed domestically from 1950 through the most recent reporting period.

Source

https://www.heritage.org/defense/report/global-us-troop-deployment-1950-2005

doi:10.1177/07388942211030885