title: How to export the output of table() in R to Excel?
body: <pre><code>gen_start &lt;- which(colnames(westpac)=="RespID") 
  gen_end &lt;- which(colnames(westpac)=="sc_frequency")
  for(i in gen_start:gen_end)
  {
   print(colnames(westpac[i]))
   print(table(westpac[,i]))
  }
  </code></pre>
  
  <p>Is is possible to export the tables in excel?? I have tried using count() function but it displays the variable name as "x" and it is not feasible to rename all the variables individually in the count() function.</p>
  
  <p>So I want to fetch both the variable name and also the frequencies of various categories under it. I tried export table once but it just gave me the frequencies only.This is how I am trying to export the output in excel sheet or something similar to this will help :</p>
  
  <pre><code>[1] "QI1_15"
  0    1 
  977 393
  
  [1] "QI1_16"
  0     1 
  1188  182 
  </code></pre>
  
  <p>Can you guys suggest some ideas or is there any alternative for this?</p>