Changelog
Source:NEWS.md
mcrutils 0.0.0.9017
Bug fixes
-
is_ytd_comparable()no longer excludes the final day of the window whendateis a datetime. Onlyend_datewas coerced to a date, so aPOSIXctdatewas compared against aDatepromoted to midnight and any timestamp later than00:00:00on the boundary day compared as later than the bound. A year-to-date filter built on a timestamp column therefore lost its last day, in every year. This contradicted the documented behaviour that the time component is ignored; both arguments are now coerced.
mcrutils 0.0.0.9016
Breaking
-
adjust_to_bizday()’s default convention is now"Preceding"(was"ModifiedPreceding"). Passbdc = "ModifiedPreceding"to restore the previous behaviour."ModifiedPreceding"cannot leave the input’s calendar month, so a month opening on a non-business day rolls forward onto that month’s first business day."Preceding"rolls back unconditionally.This means the adjusted date’s period may differ from the input’s. Callers that index an adjusted date within a period must derive the period from the adjusted date, or a value can be filed under one period and numbered within another — see the
bizday_of_period()example invignette("mcrutils").
mcrutils 0.0.0.9015
New
-
adjust_to_bizday()gains abdcargument, so the business-day convention can now be specified. Accepts any convention supported byqlcal::adjust().
Breaking
-
adjust_to_bizday()’s default convention is now"ModifiedPreceding"(was"Following"). Passbdc = "Following"to restore the previous behaviour.Forward-rolling has two problems when the adjusted date is then indexed within a period. It can move a date out of its calendar month, and
bizday_of_period()numbers whatever it is given from the start of that date’s period - so a period’s closing weekend lands on the next period’s first business day, while that period’s own closing weekend disappears. It is also inconsistent with a half-open upper bound (date < end): it moves in-scope dates ontoend, a date the caller excluded, producing a business day with no data behind it. A preceding-leaning, month-safe convention avoids both, and since every quarter and year boundary is also a month boundary it holds for those periods too.
mcrutils 0.0.0.9014
New
- Period-completeness toolkit for reporting on partial periods:
-
period_is_complete()tests whether the period (week/month/quarter/year) containing each date is complete as of a cutoff date. Completeness is business-day aware via a QuantLib calendar (default"WeekendsOnly"); pass a national calendar such as"UnitedStates"for holiday accuracy, or"Null"for pure calendar-day semantics. -
period_start_date()andperiod_end_date()return the canonical first and last calendar day of the period containing each date. -
filter_complete_periods()keeps only rows whose period is complete;as_ofdefaults to the maximum of the date column. -
last_complete_period_start()andlast_complete_period_end()return the boundaries of the most recent complete period as of a cutoff. -
scale_alpha_logical(), a ggplot2 alpha scale for fading incomplete periods (pairs withperiod_is_complete()).
-
- Completeness uses an inclusive convention: a period is complete once its end date is reached (not strictly after it). For pure calendar-day semantics use
calendar = "Null"(the QuantLib id is"Null", not"NullCalendar").NAdates propagate toNA(and are dropped byfilter_complete_periods()). -
period_is_complete(),last_complete_period_start(), andlast_complete_period_end()require an explicitas_of; there is no wall-clock default, so completeness is never judged against the current date unless you ask for it (passSys.Date()to opt in).filter_complete_periods()still defaultsas_ofto the maximum of its date column.
Behavior changes
-
most_recent_monday()/most_recent_sunday(): theref_dateargument is renamedas_of, matching the period-completeness functions (both name the date that state is evaluated as of). The default (current date) is unchanged and positional calls are unaffected, but callers passingref_date =by name must switch toas_of =.
mcrutils 0.0.0.9013
Behavior changes
-
rename_cols_for_display()now uses minor-word-aware title casing (viasnakecase::to_title_case()) instead ofstringr::str_to_title(). Short connecting words such as “of”, “to”, “per”, and “vs” stay lowercase (e.g.new_to_market-> “New to Market”). Acronym preservation viaall_capsis unchanged. Adds a dependency onsnakecase.
mcrutils 0.0.0.9012
Bug fixes
-
bizdays_between():include_firstandinclude_lastarguments were ignored and always treated asTRUE. They are now forwarded correctly toqlcal::businessDaysBetween().
mcrutils 0.0.0.9011
New
-
scale_x_integer()andscale_y_integer()for continuous ggplot scales that favor integer break labels. -
rename_cols_for_display()to convert snake_case-like column names to title-style labels with optional acronym preservation.
mcrutils 0.0.0.9010
New
-
mutate_cagrs()to compute compound annual growth rates (CAGRs) for specified columns in a data frame. -
passed_colnames(), a helper function that evaluates a tidyselect expression in the context of a data frame and returns the names of the columns that were selected.
mcrutils 0.0.0.9009
New
-
most_recent_sunday()andmost_recent_monday()to return the date of the most recent Sunday or Monday that is on or before the current date or a specified reference date.
mcrutils 0.0.0.9008
New
bizday_of_period()to compute the business day of a date within a given period (e.g. date xxx is the 3rd business day of the month according to the UnitedStates QuantLib calendar)is_bizday(),bizdays_between()which wrap similarqlcalfunctions, but allow evaluation in a specified QuantLib calendar without making persistent changes to the globally configured calendar.with_calendar()andlocal_calendar()which facilitate temporary changes to the configuredqlcalQuantLib calendar a’lawith_*()andlocal_*()functions from thewithrpackage.set_calendar()which changes the globally configured qlcal QuantLib calendar, but only if the specified calendar is valid and different from the currently configured calendar.
mcrutils 0.0.0.9007
New
-
periodic_bizdays()function to calculate business days between two dates with a specified periodicity (e.g., weekly, monthly), using RQuantLib calendars for holiday definitions. A convenience wrapper aroundbizdays::bizdays()
mcrutils 0.0.0.9006
New
-
plot_accounts_by_status()can now display lost accounts in two ways. Default behaviorlost = "detailed"shows temporarily_lost and termially_lost separately (as in prior versions), whilelost = "simple"combines them into a single lost category.
Changed
-
auto_dt()now includes copy and download buttons by default. Setbuttons = FALSEto suppress