title: Remove NA values from distance matrix in R
body: <p>I am new to R and I am looking for a way how to remove all rows and columns from a distance matrix which contain NA values. Here is an example:</p>
  
  <pre><code>set.seed(1)
  
  data &lt;- matrix(rpois(n = 400, lambda = 10), nrow = 20, ncol = 20)
  rownames(data) &lt;- LETTERS[1:20]
  dist_matrix &lt;- dist(data, method = "euclidean")
  dist_matrix[sample(1:190, 10)] &lt;- NA
  </code></pre>
  
  <p>Is there any elegant way to do this? Thank you very much!</p>