我有一个有1000行的列。它有10个国家的名字。我怎么知道每个国家重复多少次? [英] I have a column with 1000 rows. It has names of 10 countries. How can i know how many times each country is repeated?

查看:176
本文介绍了我有一个有1000行的列。它有10个国家的名字。我怎么知道每个国家重复多少次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有1000行的列。它有10个国家的名字。如何计算每个国家/地区的重复次数?

I have a column with 1000 rows. It has names of 10 countries. How can i count how many times each country is repeated?

推荐答案

最具体的解决方案是使用

The most specific solution is to use table.

table(my.column)

摘要根据数据类型进行不同的操作,但 code>始终显示每个唯一值的出现次数。例如,如果你用ID号而不是字符串代码国家, summary 会显示四分位数,这不是你想要的。

summary does different things depending on data type, but table always show the number of occurrances for every unique value. If you would code countries with ID numbers instead of character strings for instance, summary would show quartiles which is not what you want.

这篇关于我有一个有1000行的列。它有10个国家的名字。我怎么知道每个国家重复多少次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆