title: R Replacing NAs with a unique random numer
body: <p>I have a variable in a dataframe that looks something like this</p>
  
  <pre><code>x=c(1,2,4,6,7,NA,NA,5,NA,NA,9)
  </code></pre>
  
  <p>Each element in x is a unique number and I want replace NAs with unique numbers.</p>
  
  <p>What I have tried is something like this but was wondering if there is a more efficient way to do it. </p>
  
  <pre><code>x[is.na(x)]=sample(10:15,replace=F)
  Warning message:
  In x[is.na(x)] = sample(10:15, replace = F) :
    number of items to replace is not a multiple of replacement length
  </code></pre>
  
  <p>Thanks!</p>