Skip to contents

Wraps round around forecast::na.interp to provide a rounded interpolated series, which is then enforced to be greater than or equal to a minimum value (default min_val = 0) via pmax.

Usage

round_na.interp(
  x,
  lambda = NULL,
  linear = (frequency(x) <= 1 | sum(!is.na(x)) <= 2 * frequency(x)),
  digits = 0,
  min_val = 0
)

Arguments

x

A time series passed directly to forecast::na.interp.

lambda

Box-Cox transformation parameter passed directly to forecast::na.interp.

linear

logical indicator of if linear interpolation should be used. Passed directly to forecast::na.interp.

digits

integer or numeric integer of how many digits to round to. Passed directly to round.

min_val

integer or numeric integer of minimum value allowable in the series.

Value

numeric series.

See also

Examples

   round_na.interp(x = c(1, 2, 3, NA, NA, 170))
   round_na.interp(x = c(-1, 2, 3, NA, NA, 170), min_val = 1)