开发者

How can I produce a table into a data.frame?

开发者 https://www.devze.com 2023-03-18 05:00 出处:网络
I printed out the summary of a column variables as such: Please see below the summary table printed out from R:

I printed out the summary of a column variables as such:

Please see below the summary table printed out from R:

How can I produce a table into a data.frame?

I would like to generate it into a data.frame. However, there are too many subject names that it's very difficult to list out all, also, the term "OTHER" with number 31 means that there are 319 subjects which appear only 1 time in the original data.frame.

开发者_开发问答

So, the new data.frame I hope to produce would look like below:

How can I produce a table into a data.frame?


Here is one possible solution.

Table<-table(rpois(100,5))
as.data.frame(Table)
   Var1 Freq
1     1    2
2     2   11
3     3    9
4     4   18
5     5   13
6     6   20
7     7   14
8     8    8
9     9    3
10   10    1
11   11    1
0

精彩评论

暂无评论...
验证码 换一张
取 消