sorting a table for latex output with xtable

I´m trying to produce a sorted table and export in to latex. However it seems xtable cannot cope with sorted tables. 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. Use as.table() to solve your problem :

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)
链接地址: http://www.djcxy.com/p/24986.html

上一篇: 任何方式从lme4 mer模型适合对象生成LaTeX表格?

下一篇: 用xtable对乳胶输出进行排序