全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
4794 2
2016-11-23
原始数据

如图,原始数据给出用户id和此用户每年年初订购报纸的信息,我想统计每年有多少用户订购,应该使用什么命令,谢谢!
附件列表
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2016-11-23 22:54:02
According to your data, cust & year pair is unique so the problem of uniqueness is skipped. Simply counting how many times each year shows solves the question.
Assume the name of your dataframe is Sales. Use the code below:

table(Sales$year)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-11-24 13:31:03
table()函数就是统计频率的
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群