title: Table Outputs like SPSS plus export to MS Word
body: <p>Assume the following variable in <strong>R</strong>:</p>
  
  <pre><code>test &lt;- c(1,5,4,3,2,3,5,4,2,1,5,1,2,3,4, NA, NA, NA)
  </code></pre>
  
  <p>To get a frequency table, there are several ways of calculation</p>
  
  <ul>
  <li>"raw" frequencies, this means the frequencies, also including the NAs</li>
  <li>"raw" percentages, same as above, just in percentage</li>
  <li>"valid" frequencies, only those frequencies without NAs</li>
  <li>"valid" percentages, same as above, just as percentage</li>
  </ul>
  
  <p>In SPSS you get this output quite easily with the frequencies-function.</p>
  
  <p>However, in <strong>R</strong>, it's the pain in the ass. As for now, I didn't manage to get a table with the abovementioned values without spending "hours" to build this table output.</p>
  
  <p>Of course, <strong>R</strong> has all the necessary functions for calculating the values, but it's difficult to put them all together in one output, especially if you have NAs, because for the "raw" values you need a row for the NAs, for the "valid" values you do not, but if you put the values together in a matrix or something else, <strong>R</strong> complains that the rows for the raw and the valid scores are not equal.</p>
  
  <p>To make a long story short: is there a possibility to build SPSS-like frequency tables in <strong>R</strong>?</p>
  
  <p>And my second question is, how to export the tables to MS Word.</p>
  
  <p>The problem in <strong>R</strong> is, that the tables use spaces for separating the values. If you copy/paste it into MS Word, you won't be able to build a proper table.</p>
  
  <p>I'm aware that there are some packages, e.g. R2wd (which I didn't even get to work at all) or rtf (which works OK for me), but maybe you now some other possibilities.</p>
  
  <p>EDIT:</p>
  
  <p>The output table of the abovementioned example should look like:</p>
  
  <pre><code>Values    raw frequencies    raw percentage    valid freq.   valid percentage
  1         3                  16,67             3             20,00
  2         3                  16,67             3             20,00
  3         3                  16,67             3             20,00
  4         3                  16,67             3             20,00
  5         3                  16,67             3             20,00
  NA        3                  16,67             /             /
  </code></pre>
  
  <p>I have to apologize for that example. I just typed randomly some values between 1 and 5 to get different frequencies. It appears that I unvoluntarily got the same frequency for every value. -.-</p>