制作一个字符串频率表
我正在尝试制作一个包含许多字符串的汇总表。我的数据如下所示:
x<-c("a", "a", "b", "c", "c", "c", "d")
我如何一次分析每个字符串的重复次数?理想情况下,生成这样的频率表(我认为按频率递减排序很容易):
"a" 2
"b" 1
"c" 3
"d" 1
I am trying to make a summary table of many strings. My data looks like this:
x<-c("a", "a", "b", "c", "c", "c", "d")
How would I analyse the recurrence of each string at once? Ideally to produce a table of frequency like this (I presume it would be easy to sort for decreasing frequency):
"a" 2
"b" 1
"c" 3
"d" 1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
用它来制作频率表:
要排序只需使用排序。
希望有帮助
Use this to make the frecuency table:
To sort just use sort.
Hope that helps
同样,
会进行计数;然后您可以根据需要对结果进行排序。
Similarly,
will do the counting; you can then sort the results as desired.