日期和财务数据
我有一组一年的财务数据。数据在工作日内收集。 考虑到第一个数据点是在 juanari 3 号收集的,R 中有没有办法为每个数据点分配一个日期。
I have a set of one year finacial data. The data is collected in working days.
Is there any way in R to assign to each data point a date given that the first data point was collected for eaxmple on juanari the 3th.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要采取两个步骤才能找到解决方案:
seq.Date
创建日期序列 使用wday
计算星期几并删除所有具有值的日期1(周日)和7(周六)代码和结果:
PS。您将有两个单独的您所在地区的假期列表,并将它们从列表中删除。
You need to take two steps to get to a solution:
seq.Date
wday
to calculate the day of the week and remove all days with value 1 (Sunday) and 7 (Saturday)The code and results:
PS. You will have two keep a separate lists of holidays in your region and remove these from the list.
timeDate 包提供了提取您喜欢的任何金融中心的工作日的功能(其分类中有近 500 个此类金融中心)。
The timeDate package offers functions to extract business days in whatever financial center you happen to favor (there are almost 500 such financialcenters in their classification).