title: identifying unique elements in sub lists and altering
body: <p>I have the following 'list' in R:</p>
  
  <pre><code>[[1]]
  [1] 17336  5246  8597  5246 17878 19701
  
  [[2]]
  [1] 19701 37748 18155  5246  8597
  
  [[3]]
  [1] 12297 19701 17878  5246 17336  8597 17878
  
  [[4]]
  [1] 17878 37748 19701 37748 12297  8597
  
  [[5]]
  [1] 19701 37748 19701 37748 19701  5246
  
  [[6]]
  [1] 19701  6254 17336 18155 19701 12297
  
  [[7]]
  [1] 19701 17878 18155 17878 18155 19701  8597
  
  [[8]]
  [1]  8597 18155
  
  [[9]]
  [1] 12450 18155  5246  8597  5246  8597
  
  [[10]]
  [1] 18155  4105  6254 17878 12297  5246
  
  [[11]]
  [1]  8597 12297
  
  [[12]]
  [1] 17878  5246 18155 17878 12297  8597
  
  [[13]]
  [1]  8597 18155
  
  [[14]]
  [1]  5246 37748 18155 12450 18155  8597
  
  [[15]]
  [1] 19701 37748  6254  8597  6254  8597 12297
  
  [[16]]
  [1] 19701 17878  4105 37748 18155 19701 12450 12297
  
  [[17]]
  [1]  6254 12450 37748 17878  5246 17878  8597
  
  [[18]]
  [1]  8597 12297 18155  5246 18155 12297
  
  [[19]]
  [1]  4105 37748 17878  5246 12450  5246 12450
  
  [[20]]
  [1] 17878 20467
  
  [[21]]
  [1] 20467
  
  [[22]]
  [1] 12450 37748 12450 17878 12450 12297
  
  [[23]]
  [1]  6254 17878 12450 12297     5  4105 27697  4105 27697
  
  [[24]]
  [1]  4105 37748 17878 20467 12450 17878 27697
  
  [[25]]
  [1]  5246 27697  5246 17336 17878  5246 12297 20467
  </code></pre>
  
  <p>I want to find the fastest way to look through this list and find if any of the elements are a specific value, call this the 'reference value'. For example, if the reference value is '5', then I want to identify that element <code>[[23]]</code> has a '5' in it. What I would like to do is alter that element so that it becomes:</p>
  
  <pre><code>[[23]] 4105 27697  4105 27697
  </code></pre>