title: Computational error while using combination function in R
body: <p>I have a matrix in <code>R</code>, namely <code>dat</code>, and I am trying to create a information matrix using the <code>infotheo</code> package between all variable combinations. This is the code:</p>
  <pre><code>set.seed(1234)
  m &lt;- 10
  n &lt;- 5
  dat &lt;- round(matrix(runif(m * n), m, n))
  
  library(infotheo)
  a = combn(seq(ncol(dat)), 2, function(x)condinformation(dat[, x[1]], dat[,x[2]], method = 'emp'))
  b &lt;- structure(a, Size = ncol(dat), class = 'dist')
  b &lt;- as.matrix(b)
  </code></pre>
  <p>which result in the following:</p>
  <pre><code>&gt; b
              1           2          3          4           5
  1 0.000000000 0.004021743 0.06326870 0.19497599 0.004021743
  2 0.004021743 0.000000000 0.03218930 0.01384429 0.291103166
  3 0.063268705 0.032189301 0.00000000 0.01384429 0.013844294
  4 0.194975994 0.013844294 0.01384429 0.00000000 0.032189301
  5 0.004021743 0.291103166 0.01384429 0.03218930 0.000000000
  </code></pre>
  <p>My problem is that while all values are correct, i.e.,<code>condinformation(dat[, 1], dat[,2],method = 'emp')=0.004021743</code>, the diagonal elements are incorrect. For example</p>
  <pre><code>&gt; condinformation(dat[, 1], dat[,1],method = 'emp')
  [1] 0.6108643
  </code></pre>
  <p>what I am doing wrong in my code and get this result? Do you have an alternative solution for the desired outcome?</p>