to.period 中 indexAt 参数的 startof 和 firstof 值之间的差异
A difference between startof and firstof values of indexAt parameter in to.period
根据文档:
To adjust the final indexing style, it is possible to set indexAt to
one of the following: ‘yearmon’, ‘yearqtr’, ‘firstof’, ‘lastof’,
‘startof’, or ‘endof’. The final index will then be yearmon, yearqtr,
the first time of the period, the last time of the period, the
starting time in the data for that period, or the ending time in the
data for that period, respectively.
现在我尝试 to.hourly
我的分钟数据。我看到默认情况下所有值都设置为数据中的最后一分钟。我想设置为第一分钟。似乎 indexAt
正是为此的参数。我有一个小时从 09:30 开始。据我了解,'firstof'
应将其设置为 09:00(每小时时段的第一分钟),'startof'
应将其设置为 09:30(每小时数据中的第一个可用分钟)。 'startof'
似乎对我有用,但 'firstof'
不起作用而且仍然 returns 09:59!我错过了什么吗?
如果您查看 ?to.period
的 Usage 部分,您会发现只有 to.monthly
和 to.quarterly
具有 indexAt
争论。这就是 to.hourly
忽略 indexAt
参数的原因。
Issue #158 简要讨论了添加 indexAt
支持非月度和季度的可能性。
根据文档:
To adjust the final indexing style, it is possible to set indexAt to one of the following: ‘yearmon’, ‘yearqtr’, ‘firstof’, ‘lastof’, ‘startof’, or ‘endof’. The final index will then be yearmon, yearqtr, the first time of the period, the last time of the period, the starting time in the data for that period, or the ending time in the data for that period, respectively.
现在我尝试 to.hourly
我的分钟数据。我看到默认情况下所有值都设置为数据中的最后一分钟。我想设置为第一分钟。似乎 indexAt
正是为此的参数。我有一个小时从 09:30 开始。据我了解,'firstof'
应将其设置为 09:00(每小时时段的第一分钟),'startof'
应将其设置为 09:30(每小时数据中的第一个可用分钟)。 'startof'
似乎对我有用,但 'firstof'
不起作用而且仍然 returns 09:59!我错过了什么吗?
如果您查看 ?to.period
的 Usage 部分,您会发现只有 to.monthly
和 to.quarterly
具有 indexAt
争论。这就是 to.hourly
忽略 indexAt
参数的原因。
Issue #158 简要讨论了添加 indexAt
支持非月度和季度的可能性。