title: Specifying a proportion in a nested table in prop.table
body: <p>I make a four way table with <code>xtabs</code></p>
  
  <pre><code>library(magrittr)
  xtabs( ~ vs + gear + cyl, data = mtcars) %&gt;% 
    ftable(row.vars = "gear")
  </code></pre>
  
  <p>returns </p>
  
  <pre><code>     vs   0        1      
       cyl  4  6  8  4  6  8
  gear                      
  3         0  0 12  1  2  0
  4         0  2  0  8  2  0
  5         1  1  2  1  0  0
  </code></pre>
  
  <p>Now I want proportions <em>within</em> levels of <code>mtcars$vs</code>. </p>
  
  <p>If I use <code>prop.table</code></p>
  
  <pre><code>xtabs( ~ vs + gear + cyl, data = mtcars) %&gt;% 
    ftable(row.vars = "gear") %&gt;% 
    prop.table(margin = 1) %&gt;% 
    round(2)
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>     vs     0              1          
       cyl    4    6    8    4    6    8
  gear                                  
  3        0.00 0.00 0.80 0.07 0.13 0.00
  4        0.00 0.17 0.00 0.67 0.17 0.00
  5        0.20 0.20 0.40 0.20 0.00 0.00
  </code></pre>
  
  <p>Ie--I want the entry for vs == 0, gear == 3, cyl == 8, to be 1.00</p>