这是我的代码,
x<-c(70, 82, 91, 76, 84, 94, 72, 76, 74, 67, 70, 45, 69, 86, 75,
84, 63, 93, 87, 67, 71, 83, 90, 88, 58, 69, 91, 74, 80, 79,
75, 88, 87, 50, 80, 84, 94, 72, 85, 71, 81, 74, 75, 81, 75, 57,
78, 78, 61, 60)
y<-table(cut(x, breaks=c(0,60,70,80,90,100),include.lowest=TRUE,right=FALSE))
z<-cbind(y,prop=prop.table(y)*100)
z
我可以拿到桌子:
y prop
[0,60) 4 8
[60,70) 7 14
[70,80) 18 36
[80,90) 15 30
[90,100] 6 12
如果我想获得表格,例如
y prop%
[0,60) 4 8
[60,70) 7 14
[70,80) 18 36
[80,90) 15 30
[90,100] 6 12
我能怎么做?