# load entropy library
library("entropy")
# joint distribution of two discrete variables
freqs2d = rbind( c(0.2, 0.1, 0.15), c(0, 0.3, 0.25) )
# and corresponding mutual information
mi.plugin(freqs2d)Run the code above in your browser using DataLab