title: Replace values in list while preserving original shape/length
body: <p>I have a list of values t_blocks with length [1] 22 below in which I need to replace all every instance there is a value with "ord". </p>
  
  <pre><code>[[1]]
  [1] 3 4 5
  
  [[2]]
  [1] 6 7 8 9
  
  [[3]]
  [1] 10 11 12
  
  [[4]]
  [1] 13 14 15 16
  
  [[5]]
  [1] 17 18 19 20 21
  
  [[6]]
  [1] 22 23 24 25 26
  
  [[7]]
  [1] 27 28 29 30 31 32 33
  
  [[8]]
  [1] 34 35
  
  [[9]]
  [1] 36 37 38 39 40 41
  
  [[10]]
  [1] 42 43 44 45 46
  
  [[11]]
  [1] 47 48 49 50
  
  [[12]]
  [1] 51 52 53 54 55
  
  [[13]]
  [1] 56 57
  
  [[14]]
  [1] 58 59 60 61 62
  
  [[15]]
  [1] 63 64 65 66 67 68 69
  
  [[16]]
  [1] 70 71 72
  
  [[17]]
  [1] 73 74 75 76 77
  
  [[18]]
  [1] 78 79 80 81
  
  [[19]]
  [1] 82 83 84
  
  [[20]]
  [1] 85 86 87 88 89
  
  [[21]]
  [1] 90 91 92 93 94
  
  [[22]]
  [1] 2
  </code></pre>
  
  <p>I have tried <code>relist</code> and <code>replace</code>:</p>
  
  <pre><code>t_scaling = unlist(t_blocks)
  relist(replace( t_scaling,  t_scaling&gt;="0", "ord"), skeleton=t_blocks)
  </code></pre>
  
  <p>but this results in a list with a length of [1]93. </p>
  
  <p>Are there any other methods that could replace whilst preserving the original 'shape' of the t_blocks list?</p>