title: how to write into .txt file in R?
body: <p>I have a data that looks like this.For example:</p>
  
  <pre><code> A;a 
   B;a 
   C;b 
   D;c
   A;b
   A;d
   C;c 
   ....
  </code></pre>
  
  <p>First pos = key , second pos = value. If key; value , then 1 ,if not then 0;</p>
  
  <p>I would to create binary matrix from data.</p>
  
  <pre><code>   a b c d
   A 1 1 0 1  
   B 1 0 0 0
   C 0 1 1 0
   D 0 0 0 1
  </code></pre>
  
  <p>I could create matrix, my code:</p>
  
  <pre><code>KeyandValue = read.table('~/RStudioProjects/TestData.txt',sep=';',header = FALSE)
  
  tableForData &lt;- table(KeyandValue$V1,KeyandValue$V2)
  tableForData[tableForData &gt; 1] &lt;- 1
  
   csvFile&lt;- write.table(tableForData,file = 
    "~/RStudioProjects/TestData.csv",quote = F,sep = ";")
    write.csv(csvFile)
  </code></pre>
  
  <p>Now, i want to re-write to .txt format in this form:</p>
  
  <pre><code>A;a;1
  A;b;1
  A;c;0
  A;d;1
  B;a;1
  B;b;0
  B;c;0
  B;d;0   
  .....
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>t3&lt;-tableForData[,]
  View(t3)
  </code></pre>
  
  <p>then i view table in this form 
   <a href="https://i.stack.imgur.com/92QXC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/92QXC.png" alt="enter image description here"></a></p>
  
  <p>How i can write in this form into .txt file?</p>