【发布时间】:2021-04-04 22:43:17
【问题描述】:
有没有办法根据周末在日期列中找到最大日期
df
ColA
2021-03-12
2021-03-16
2021-03-17
2021-03-24
2021-03-26
df
ColA Max_Date
2021-03-12 2021-03-12 (## Since Mar 12 is the end of week for 2021-03-12 )
2021-03-16 2021-03-19 (## Since Mar 19 is the end of week for 2021-03-16 )
2021-03-17 2021-03-19 (## Since Mar 19 is the end of week for 2021-03-17 )
2021-03-24 2021-03-26 (## Since Mar 26 is the end of week for 2021-03-24 )
2021-03-26 2021-03-26 (## Since Mar 26 is the end of week for 2021-03-26 )
因此,根据周末,填充最大日期
【问题讨论】:
-
lubridate'sceiling_date应该给你你想要的。更多详情here.
标签: r