There is a newer version of the record available.

Published June 11, 2019 | Version v1.0.0

reconhub/aweek: aweek version 1.0.0

Authors/Creators

  • 1. Imperial College London

Description

This version is presented of aweek is presented as a more mature and stable version of aweek:

  • combining objects is more predictable
  • weeks/dates can be created from vectors with heterogeneous week_starts
  • documentation is improved
  • data frames can be created
NEW FUNCTIONS
  • change_week_start() allows the user to change the week_start attribute of an aweek object, adjusting the weeks to match the new attribute accordingly.
  • get_aweek() can generate aweek objects from a vector of week numbers. It has the ability to take into account different week start times.
  • get_date() is similar to get_aweek(), but returns dates instead.
  • as.aweek() allows users to create aweek object directly from characters with validation. It also allows for dates by passing to date2week().
  • as.data.frame.aweek() is a new function that allows aweek objects to be directly incorporated into data frames.
  • as.list.aweek() will now preserve the aweek structure in lists
  • trunc.aweek() will truncate the day to the first day of the week.
  • rep.aweek() allows repeating aweek characters.
  • factor_aweek() allows the user to create aggregated aweek objects on the fly.
BREAKING CHANGES

There are a couple of breaking changes coming to aweek that will improve stability by removing unclear coercion methods (see https://github.com/reconhub/aweek/issues/20).

  • It is no longer possible to combine aweek objects if they do not share the same week_start attribute. This will result in an error informing the user to adjust the week_start attribute with the change_week_start() function.
  • Factors will no longer coerce factors when combining aweek objects.
  • Using date2week() with factor = TRUE and floor_day = FALSE now throws an error instead of a warning (as prophesized in #13).
DOCUMENTATION
  • The vignette has been updated to include an explanation of the underlying week calculation from date.
  • The aweek class documentation has been updated to detail the different elements of the object and the calculations.
  • Package documentation package?aweek has been added for an introduction.
BUG FIX
  • conversions will now retain the names of the object.
MISC
  • More checks that weekdays and weeks are within the correct bounds have been added.
  • as.Date.aweek has been simplified to no longer rely on regex since the aweek class is standard.
  • The internal get_wday() has been vastly simplified with improved speed.

Files

reconhub/aweek-v1.0.0.zip

Files (142.4 kB)

Name Size Download all
md5:aca37b49e44f12ccbc93531510a8097a
142.4 kB Preview Download

Additional details

Related works