Is there a quick way to check for multicollinearity between categorical variables in R?
In my work I usually use Normalized Mutual Information (NMI) to get an understanding of how "correlated" two categorical variables are.

Normalized Mutual Information is an information-theoretic measure that tells you how much information is shared by two variables. If NMI is close to 1, the two variables are very "correlated", while if NMI is close to 0 the two variables are "uncorrelated".

I wrote this function that computes the NMI between the first two variables in a data.table. It is quite fast thanks to data.table. Feel free to use it!

compute_mutualinfo &lt;- function(df){
  require(data.table)
  require(entropy)
  var1 = names(df)[1]
  var2 = names(df)[2]
  tmp_tab &lt;- df[,.N,by=c(var1,var2)]
  names(tmp_tab)[1:2] &lt;- c('V1','V2')
  cross_tab &lt;- tapply(tmp_tab$N,list(addNA(as.factor(tmp_tab$V2),ifany = T), addNA(as.factor(tmp_tab$V1),ifany = T)), sum)
  cross_tab[is.na(cross_tab)] &lt;- 0
  mi.plugin(cross_tab)/sqrt(entropy(df[,.N,by=var1,with=T][,N])*entropy(df[,.N,by=var2,with=T][,N]))
}