Cluster a categorical variable without breaking the existing categories Let’s say I am modelling data on flights and delays. I have 14 airlines (carrier variable) in the data below. I would like to know if I can create fewer categories or clusters of this categorical data, so instead of having 14 airlines maybe end up with 3 or 4 clusters of airlines. 

require(data.table)
# Data takes ~30 seconds to load
flights &lt;- as.data.table(read.csv(url("https://raw.githubusercontent.com/wiki/arunsrinivasan/flights/NYCflights14/flights14.csv")))
length(unique(flights$carrier))

km &lt;- kmeans(flights[,.(dep_delay,carrier)], centers = 4, nstart = 1)


Is there any methodology that could be used? I tried k-means but it seems it is not the most appropriate.
Without looking at the data, can't you just use your Domain Knowledge to create meaningful groups/attributes for the airlines data frame? Such as "low-cost carrier/premium", "foreign (non-USA) airline/US-Airline" , "long-distance carrier/domestic only", "founded in decade" ,  or whatever? With only 14 airlines you can assign appropriate values yourself, manually, without relying on some cryptic algorithm.

Besides, is your dataset identical to the dataset in the R package "nycflights13"?

If so, you could easily load it with library(nycflights13), after installing the package of course.