Installation

# Install development version from GitHub (requires devtools package)
devtools::install_github("bgreenwell/afsc")

# Load package
library(afsc)

# List all the objects in the afsc package
ls("package:afsc")

Basic pattern analysis

The first two are enlisted AFSCs, the latter contains a prefix and suffix (both of which are optional). The second two are officer AFSCS, the first of which contains a prefix. The last four are not valid AFSCs; the last one is an AFSC, but has been entered incorrecltly (it has aan extra whitespace and the letter is lowercase).

afscs <- c("X1N371E", "9T000", "T63A3", "63A3", "ABCDE", NA, "", " 63a3")
unique_patterns(afscs, as_table = TRUE)

Only four of the patterns match those of an enlisted or officer AFSC.

Checking AFSCs for correctness

is_valid_afsc(afscs)
get_valid_afscs(afscs)
get_invalid_afscs(afscs)
is_enlisted(afscs)  # logical vector
is_officer(afscs)  # logical vector
afsc_type(afscs)  # character vector

Extracting different AFSC components

get_prefix(afscs)
get_suffix(afscs)


bgreenwell/afsc documentation built on May 12, 2019, 8:19 p.m.