title: Editing an existing .txt file by exporting data from R
body: <p>I'm creating some simulated disease count data for spatial modeling in OpenBUGS via the <code>BRugs</code> package in R. </p>
  
  <p>I have an existing <code>.txt</code> file which contains most of the information I need to run my models in <code>BRugs</code>. Here's what this text file looks like:</p>
  
  <pre><code>list(N = 44,
     O = c(4, 8, 3, 6, 2, 7, 7, 2, 10, 13, 5, 7, 9, 3, 3, 1, 2, 3, 19, 7, 5, 4, 
          9, 2, 4, 6, 14, 13, 6, 7, 9, 3, 4, 10, 10, 8, 23, 24, 18, 10, 6, 4, 17, 7), 
     E = c(7.20902956, 7.81436792, 3.46693788, 7.04393728, 7.37412184, 
          4.45749156, 6.3285374, 4.45749156, 6.3285374, 6.76878348, 9,...)
     etc....
      ),
      sumNumNeigh = 212
      )
  </code></pre>
  
  <p>What I'd like to accomplish is to replace the <code>O</code> vector in the above <code>.txt</code> file with the <code>m</code> simulated disease count vectors than I generated in R. This way, I can have <code>m</code> new .txt files to use with <code>BRugs</code> to run my models.</p>
  
  <p>For instance, let's say this new disease count vector is called <code>O_sim</code>:</p>
  
  <pre><code> [1]  6  4  6  9  9  6 11  6  7  6 11  9  7 10  9 10  9  3 10  4  6  8  8  4  6  9  8  6  9  8  7  8  5 10  8  6  4  4  5  5  8
  [42] 10  8 11
  </code></pre>
  
  <p>How could I go about created a new .txt file that now looks like this:</p>
  
  <pre><code> list(N = 44,
      O = c(6,4,6,9,9,6,11,6,7,6,11,9,  
            7,10,9,10,9,3,10,4,6,8,8,4,6,
            9,8,6,9,8,7,8,5,10,8,6,4,4,5,5,
            8,10,8,11), 
      E = c(7.20902956, 7.81436792, 3.46693788, 7.04393728, 7.37412184, 
             etc...
           ),
      sumNumNeigh = 212
      ) 
  </code></pre>