title: How to cross-tabulate two variables in R?
body: <p>This seems to be basic, but I wont get it. I am trying to compute the frequency table in R for the data as below </p>
  
  <pre><code>1 2 
  2 1 
  3 1  
  </code></pre>
  
  <p>I want to transport the the two way frequencies in csv output, whose rows will be all the unique entries in column A of the data and whose columns will be all the unique entries in column B of the data, and the cell values will be the number of times the values have occurred. I have explored some constructs like <code>table</code> but I am not able to output the values correctly in csv format.</p>
  
  <p>Output of sample data:</p>
  
  <pre><code>"","1","2"
  "1",0,1
  "2",1,0
  "3",1,0
  </code></pre>