Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

latestPeriod

Most Recent Period Time Indexes


Description

Return a ti for the most recent period of the desired frequency.

Usage

latestWeek(xTi = today())
latestMonth(xTi = today())
latestQuarter(xTi = today())
latestHalf(xTi = today())
latestYear(xTi = today())
latestQ4(xTi = today())
latestJanuary(xTi = today())
latestFebruary(xTi = today())
latestMarch(xTi = today())
latestApril(xTi = today())
latestMay(xTi = today())
latestJune(xTi = today())
latestJuly(xTi = today())
latestAugust(xTi = today())
latestSeptember(xTi = today())
latestOctober(xTi = today())
latestNovember(xTi = today())
latestDecember(xTi = today())

Arguments

xTi

a ti object or something that the ti() function can turn into a ti object

Details

The latest{whatever} functions are the same as the corresponding current{whatever} functions, except that they return the most recent completed ti of the desired frequency. A period is considered to be completed on it last day. For example, if today is Thursday, then latestWedweek() returns the week that ended yesterday. Yesterday it would have returned the same week, but the day before that (Tuesday) it would have returned the "wwednesday" ti for the week that had ended six days before.

latestWeek returns the weekly ti for the most recently completed week as of xTi. If the xTi is itself a ti, the returned week is the most recently completed week as of the last day of xTi. (Note that the default weekly frequency is "wmonday" (Monday-ending weeks), so latestWeek always returns "wmonday" ti's.) See setDefaultFrequencies to change this.

All of the other latest{SomeFreq} functions work the same way, returning the ti's for the most recently completed SomeFreq as of the last day of xTi. The tif's (frequencies) for latestHalf and latestQ4 are "semiannual" and "quarterly", respectively.

latestJanuary returns the monthly ti for January of the most recently completed January-ending year that the last day of its argument falls into. latestFebruary returns the monthly ti for February of the most recently completed February-ending year that the last day of its argument falls into, and so on.

Value

All return return ti objects as described in the details.

See Also


tis

Time Indexes and Time Indexed Series

v1.38
Unlimited
Authors
Jeff Hallman <jeffhallman@gmail.com>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.