title: Duplicate row in R with condition is met
body: <p>I'm trying desperately to fix an issue with my data, but I can't seem to find anything in the forums that will help (or I know so little that I'm not searching for the correct thing).</p>
  
  <p>I have the following data, and when the value in the Mumbai Column is equal to zero, I would like to duplicate that entire row and copy it underneath.</p>
  
  <p>Is there any way to do this in R, or am I better off calling a VBA script?</p>
  
  <p>Before:</p>
  
  <pre><code>Row Shanghai    Mumbai  Beijing Paris   Hong Kong   Wellington
  5.7 0.4 6.2 9.9 4.1 3.4
  5.1 7.5 1.8 9.2 4.8 9.9
  5.0 1.5 4.4 7.2 4.5 6.6
  5.7 5.4 6.7 9.1 2.9 9.0
  8.2 7.7 2.3 9.8 0.2 3.1
  3.4 0.0 6.5 5.4 0.2 0.5
  1.0 9.5 2.8 5.7 2.8 2.5
  8.4 9.9 2.1 6.3 9.3 8.4
  3.8 3.4 5.1 5.8 0.7 1.8
  4.5 3.9 8.3 5.8 7.3 4.7
  5.3 8.9 9.2 9.7 2.8 0.2
  0.7 0.0 2.3 4.6 5.9 2.8
  1.4 2.6 4.0 7.2 5.5 1.0
  4.7 8.2 4.1 5.0 8.9 3.0
  8.9 4.7 0.2 4.0 1.0 7.8
  </code></pre>
  
  <p>After </p>
  
  <pre><code>Shanghai    Mumbai  Beijing Paris   Hong Kong   Wellington      
  5.7 0.4 6.2 9.9 4.1 3.4     
  5.1 7.5 1.8 9.2 4.8 9.9     
  5.0 1.5 4.4 7.2 4.5 6.6     
  5.7 5.4 6.7 9.1 2.9 9.0     
  8.2 7.7 2.3 9.8 0.2 3.1     
  3.4 0.0 6.5 5.4 0.2 0.5     
  3.4 0.0 6.5 5.4 0.2 0.5     # DUPLICATE ROW
  1.0 9.5 2.8 5.7 2.8 2.5     
  8.4 9.9 2.1 6.3 9.3 8.4     
  3.8 3.4 5.1 5.8 0.7 1.8     
  4.5 3.9 8.3 5.8 7.3 4.7     
  5.3 8.9 9.2 9.7 2.8 0.2     
  0.7 0.0 2.3 4.6 5.9 2.8     
  0.7 0.0 2.3 4.6 5.9 2.8     # DUPLICATE ROW
  1.4 2.6 4.0 7.2 5.5 1.0     
  4.7 8.2 4.1 5.0 8.9 3.0     
  8.9 4.7 0.2 4.0 1.0 7.8     
  </code></pre>
  
  <p>Input data:</p>
  
  <pre><code>structure(list(Shanghai = c(5.7, 5.1, 5, 5.7, 8.2, 3.4, 1, 8.4,             
  3.8, 4.5, 5.3, 0.7, 1.4, 4.7, 8.9), Mumbai = c(0.4, 7.5, 1.5,           
  5.4, 7.7, 0, 9.5, 9.9, 3.4, 3.9, 8.9, 0, 2.6, 8.2, 4.7), Beijing = c(6.2,           
  1.8, 4.4, 6.7, 2.3, 6.5, 2.8, 2.1, 5.1, 8.3, 9.2, 2.3, 4, 4.1,          
  0.2), Paris = c(9.9, 9.2, 7.2, 9.1, 9.8, 5.4, 5.7, 6.3, 5.8,            
  5.8, 9.7, 4.6, 7.2, 5, 4), Hong.Kong = c(4.1, 4.8, 4.5, 2.9,            
  0.2, 0.2, 2.8, 9.3, 0.7, 7.3, 2.8, 5.9, 5.5, 8.9, 1), Wellington = c(3.4,           
  9.9, 6.6, 9, 3.1, 0.5, 2.5, 8.4, 1.8, 4.7, 0.2, 2.8, 1, 3, 7.8          
  )), class = "data.frame", row.names = c(NA, -15L))          
  </code></pre>