简体   繁体   English

使用xtable为乳胶输出排序表

[英]sorting a table for latex output with xtable

I´m trying to produce a sorted table and export in to latex. 我正在尝试生成一个已排序的表并导出到latex中。 However it seems xtable cannot cope with sorted tables. 然而,似乎xtable无法应对已排序的表。 Suggestions? 建议?

   a<-sample(letters,500,replace=T)
    b<-table(a)
    c<-sort(table(a),decreasing=T)
    xtable(b)
    xtable(c)

//M //中号

Pretty easy: sort() does not return a table, but an array. 很简单:sort()不返回表,而是返回数组。 Use as.table() to solve your problem : 使用as.table()来解决您的问题:

a<-sample(letters,500,replace=T)
b<-table(a)
class(b)
c<-sort(table(a),decreasing=T)
class(c)
d <- as.table(c)
class(d)
xtable(d)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM