Adding Levels To A Factor

Want to learn more? I recommend working through: R for Data Science, R Cookbook, and R Graphics Cookbook.

# create simulated distract name data
district <- c("NORTH", "NORTHWEST", "CENTRAL", "SOUTH", "SOUTHWEST", "EAST")

# remake district categories with the combination of district categories and a new SOUTH CENTRAL category
levels(district) <- c(district, "SOUTH CENTRAL")
levels(district)
[1] "NORTH"         "NORTHWEST"     "CENTRAL"       "SOUTH"        
[5] "SOUTHWEST"     "EAST"          "SOUTH CENTRAL"