gpt4 book ai didi

r - 求每月速度的平均值(使用 R)

转载 作者:行者123 更新时间:2023-12-02 04:21:08 25 4
gpt4 key购买 nike

我这里有数据表:

row      V1      velocity

1 2009-04-06 95.9230769230769

2 2009-04-11 95.0985074626866

3 2009-04-17 95.8064935064935

4 2009-04-22 94.6357142857143

5 2009-04-27 95.3626865671642

6 2009-05-03 95.9101265822785

7 2009-05-08 95.826582278481

8 2009-05-14 94.5126582278481

9 2009-05-20 95.8371428571429

10 2009-05-25 94.6981481481481

11 2009-05-30 96.397619047619

12 2009-06-05 94.8132530120482

13 2009-06-10 96.4558139534884

14 2009-06-16 94.9627906976744

15 2009-06-21 95.2666666666667

16 2009-06-26 95.2919540229885

17 2009-07-01 95.4333333333333

18 2009-07-07 95.3375

19 2009-07-12 95.0534246575343

20 2009-07-18 96.0277777777778

21 2009-07-24 95.6885057471264

22 2009-07-29 93.9375

23 2009-08-03 95.2776315789474

24 2009-08-08 94.9089285714286

25 2009-08-13 96.8906976744186

26 2009-08-19 95.4487804878049

27 2009-08-24 97.2444444444444

28 2009-08-30 95.1174418604651

我想编写一个 r 代码来查找每月的速度平均值。 (有五月、六月、七月和八月。

我能做什么?

最佳答案

或者只是:

tapply(df$velocity, months(as.Date(df$V1)), mean)
April August Juli Juni Mai
95.36530 95.81465 95.24634 95.35810 95.53038

关于r - 求每月速度的平均值(使用 R),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30380072/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com