title: writeLines to an outside file in a loop
body: <p>I'm fairly new to R, but basically I want to write certain parts of a data frame as text to an outside txt file. This is the code that I have,</p>
  <pre><code>for (i in 1:nrow(myd)) {
      if (i &gt; nrow(myd)) {
        fileConn&lt;-file(&quot;output.txt&quot;)
        writeLines(c(paste0(myd[i,2]),paste0(myd[i,4]), paste0(myd[i,11]),paste0(myd[i,8])), fileConn)
    } else
      close(fileConn)
  }
  </code></pre>
  <p>This code only gives me the last row's data, is there a way to append each loop?</p>