本文介绍了在一个xts对象中的第N个日子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
价格是一个xts对象
period.ends = endpoints(prices, 'months',k=1)与这一行我找到一个月的最后一天的位置在一个时间序列。
with this line i find position of the last day of the month in a time series.
如何找到月的第一天的位置(不总是1个月)?第二天?
How to find position of the first day of month (not always 1 of the month)? And the second day?
谢谢
推荐答案startpoints <- function (x, on = "months", k = 1) { head(endpoints(x, on, k) + 1, -1) } period.starts = startpoints(prices, 'months', k=1)
另请参见: xts ::: startof 和 xts :: firstof
更多推荐
在一个xts对象中的第N个日子
发布评论