r - How to add a horizontal line in tables::tabular() output? -


i add horizontal line (using hline()) in moderately complex tables::tabular() output, when there 2 factors on 1 side of table.

consider this:

require(tables) require(car) latex(     tabular( (factor(partner.status, "status") +  1)           * (factor(fcategory, "authoritarianism") + 1)          * ((pct=percent()))*format(digits=1)           ~ 1, data=moore)  ) 

which yield:

\begin{tabular}{lllc} \hline status & authoritarianism &  & \multicolumn{1}{c}{all} \\  \hline high & high & pct  & $\phantom{0}16$ \\  & low & pct  & $\phantom{0}11$ \\  & medium & pct  & $\phantom{0}24$ \\  & & pct  & $\phantom{0}51$ \\ low & high & pct  & $\phantom{0}18$ \\  & low & pct  & $\phantom{0}22$ \\  & medium & pct  & $\phantom{00}9$ \\  & & pct  & $\phantom{0}49$ \\ & high & pct  & $\phantom{0}33$ \\  & low & pct  & $\phantom{0}33$ \\  & medium & pct  & $\phantom{0}33$ \\  & & pct  & $100$ \\ \hline  \end{tabular} 

which compiles (with of \usepackage{booktabs}) to:

enter image description here

in output above, place horizontal line after 1st , 2nd all fields authoritarianism column (that is, line before low row , line before all row). ho can that?

i tried use hline() follows, resulting code isn't compilable latex:

latex(     tabular( (factor(partner.status, "status") +  1)               * (factor(fcategory, "authoritarianism") + 1 + hline())              * ((pct=percent()))*format(digits=1)               ~ 1, data=moore)  ) 


Comments