Description Usage Format Details Source References Examples
This dataset contains demographic information on every member of the US armed forces including gender, race, and rank.
1  | 
A data frame with 1414593 observations on the following 6 variables.
gradeThe status of the service member as enlisted officer or warrant officer.
branchThe branch of the armed forces: air force, army, marine corps, navy.
genderWhether the service member is female or male.
raceThe race identified by the service member: ami/aln (american indian/alaskan native), asian, black, multi (multi-ethinic), p/i (pacific islander), unk (unknown), or white.
hispWhether a service member identifies with being hispanic (TRUE) or not (FALSE).
rankThe numeric rank of the service member (higher number indicates higher rank).
The branches covered by this data set include the Army, Navy, Air Force, and Marine Corps. Demographic information on the Coast Guard is contained in the original data set but has not been included here.
Data provided by the Department of Defense and made available at data.gov. Retrieval date: Feb 20, 2012.
OpenIntro, openintro.org
1 2 3 4 5 6 7 8 9 10 11 12  | data(military)
cond1 <- military$grade == "officer"
cond2 <- military$branch == "army"
cond3 <- military$gender == "female"
tabF  <- table(military$rank[cond1 & cond2 & cond3])
barplot((tabF/sum(tabF)), main = "female army officer ranks")
tabM  <- table(military$rank[cond1 & cond2 & !cond3])
barplot(tabM/sum(tabM), main = "male army officer ranks")
(tabFM <- table(military$branch, military$gender) /
          matrix(rep(table(military$branch), 2), ncol = 2))
barplot(tabFM[,1], main = "proportion female")
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.