문제

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)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top