将收集的最后日期设置为星期一 [英] Setting the last date collected to be a Monday
本文介绍了将收集的最后日期设置为星期一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用 Quantmod 下载数据集
I can download a data set using Quantmod
library(quantmod)
getSymbols("SPY", from="2013-01-01", to=Sys.Date())
chartSeries(SPY)
我希望最后收集的数据总是在星期一(所以如果我在星期四收集数据,那么星期二、星期三和星期四的数据点将被过滤掉).有没有办法做到这一点.
I would like the last data to be collected to be always on a Monday (so if I collect data on say Thursday, the Tuesday,Wednesday and Thursday data points will be filtered out). Is there a way to do this.
感谢您的帮助.
推荐答案
用 to=(Sys.Date()-c(6:0))[格式((Sys.Date()-c(6:0)),"%w")=="1"]
这篇关于将收集的最后日期设置为星期一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文