使用pander和CrossTable的列和行百分比的表?

使用pander和CrossTable的列和行百分比的表?,r,knitr,pander,R,Knitr,Pander,我正在尝试使用knitr和pander生成报告。要在表格中显示行或列百分比,我希望使用CrossTable()函数,并去掉卡方贡献值和表格总数 以下是一个例子: ```{r} x <- c(1,1,2,2) y <- c(1,2,1,2) CrossTable(x, y, prop.chisq=FALSE, prop.t = FALSE) 结果显示错误消息: Quitting from lines 45-78 (test.Rmd) Fehler in apply(x$pr

我正在尝试使用knitr和pander生成报告。要在表格中显示行或列百分比,我希望使用
CrossTable()
函数,并去掉卡方贡献值和表格总数

以下是一个例子:

 ```{r}
x <- c(1,1,2,2)

y <- c(1,2,1,2)

CrossTable(x, y, prop.chisq=FALSE, prop.t = FALSE)
结果显示错误消息:

  Quitting from lines 45-78 (test.Rmd) Fehler in apply(x$prop.tbl, c(1, 2), to.percent):   dim(X) must have a positive length Calls: ... eval -> eval -> pander -> pander.CrossTable -> apply
如何使用
pander
CrossTable
生成只包含行和列百分比的表

亲切问候,,
Maller

这一点已在pander的中修复,并带有:


这是有关的,应该很快解决。非常感谢您的快速回复和解决问题的努力!
  Quitting from lines 45-78 (test.Rmd) Fehler in apply(x$prop.tbl, c(1, 2), to.percent):   dim(X) must have a positive length Calls: ... eval -> eval -> pander -> pander.CrossTable -> apply
> pander(descr::CrossTable(x, y, prop.chisq=FALSE, prop.t = FALSE), split.table = Inf)

------------------------------------
 &nbsp;      1        2      Total  
--------- -------- -------- --------
**1**\    &nbsp;\  &nbsp;\  &nbsp;\ 
  N\        1\       1\       2\    
Row(%)\    50%\     50%\      50%   
Column(%)   50%      50%            

**2**\    &nbsp;\  &nbsp;\  &nbsp;\ 
  N\        1\       1\       2\    
Row(%)\    50%\     50%\      50%   
Column(%)   50%      50%            

  Total     2\       2\        4\   
            50%      50%            
------------------------------------