padr 0.4.1 - 0.4.2

Patch releases with no impact for the user of the software.

padr 0.4.0

Improvements

New Features

Bug Fixes / Enhancements

Further Changes

padr 0.3.0

Changes

Interval no long required to be of a single unit

The interval is no longer limited to be of a single unit, for each of the eight interval sizes. Every time span accepted by seq.Date or seq.POSIXt is now accepted. Since the original implementation was fully around single-unit-intervals, some default behavior had to change. Because of it, this version is not entirely backwards compatible with earlier versions of padr. The following functions are affected:

date_var <- as.Date(c(‘2017-01-01’, ‘2017-01-03’, ‘2017-01-05’)) get_interval(date_var)

x <- data.frame(date_var, y = 1:3)

Since the interval of date_var used be “day”, there were missing records for 2017-01-02 and 2017-01-04. These records were inserted, with missing values for y. However, now the interval of date_var is “2 day” and on this level there is no need for padding. To get ther original result the interval argument should be specified with “day”.

Changes in pad

Pad has been reimplemented

The function was slow when applied on many group becuaus looped over them. Function has been reimplemented so it needs only one join to do the padding for all the groups simultaneously. dplyr functions are used for this new implementation, both for speed and coding clarity.

When applying pad to groups the interval is determined differently. It used to determine the interval seperately for each of the groups. With the new interval definition this would often yield undesired results. Now, the interval on the full datetime variable, ignoring the groups. If the user would like to allow for differing intervals over the groups it is advised to use dplyr::do. See also the final example of pad.

dplyr::group_by

Besides its own argument for grouping, pad does now also accepts the grouping from dplyr. Making the following two results equal:

x %>% dplyr::group_by(z) %>% pad x %>% pad(group = ‘z’)

Moreover, both pad and thicken now maintain the grouping of the input data_frame. The return from both functions will have the exact same grouping.

break_above

This new argument to pad is a safety net for situations where the returned dataframe is much larger than the user anticipated. This would happen when the datetime variable is of a lower interval than the user thought it was. Before doing the actual padding, the function estimates the number of rows in the result. If these are above break_above the function will break.

Changes in thicken

fill_by functions default behavior is changed.

They used to require specification of all the column names that had to filled. This is annoying when many columns had to filled. The functions no longer break when no variable names are specified, but they fill all columns in the data frame.

New features

pad_int

The new function pad_int does padding of an integer field. Its working is very similar to the general pad. The by argument must alway be specified, since a data.frame would almost alway contain multiple numeric columns. Instead of the interval, one can specify the step size by which the integer increases.

Bug fixes

Other changes

padr 0.2.1

Bug fixes

padr 0.2.0

New feature

pad has gained a group parameter. This takes a character vector that indicates the column names within which group padding must be done. The returned data frame is complete for the grouping variable(s). Leaving no longer the doubt which record belongs to which group member, especially when start_val and / or end_val was specified.

Bug fixes

padr 0.1.0