计算一列日期计数
我想计算人们拥有的日期(或访问)数量(或访问)的平均值和标准偏差。示例数据为:
id date
1 2015-02-23
1 2015-04-24
2 2018-05-23
2 2022-12-05
2 2022-12-06
3 2021-05-21
ID1有2次访问(由2个日期证明),ID2有3次访问,ID3有1次访问,因此平均值为(2+3+1)/3 = 2。
有人知道如何计算平均值和标准偏差吗?我尝试使用总结函数来执行此操作,但我无法正常工作。
I want to calculate the mean and standard deviation for the number of dates (or visits) that people have. Sample data are:
id date
1 2015-02-23
1 2015-04-24
2 2018-05-23
2 2022-12-05
2 2022-12-06
3 2021-05-21
ID1 has 2 visits (evidenced by 2 dates), ID2 has 3 visits, and ID3 has 1 visit, so the mean would be (2+3+1)/3 =2.
Does anyone know how to calculate the mean and standard deviation? I tried to do this using the summarize function, but I can't get it to work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
rle
函数与ID
You can use
rle
function with yourid