Skip to contents

Data Transformation: Rescaling Values of Zoo Time Series to a New Range

Usage

f_rescale(x = NULL, new_min = 0, new_max = 1, old_min = NULL, old_max = NULL)

Arguments

x

(required, zoo object) Time Series. Default: NULL

new_min

(optional, numeric) New minimum value. Default: 0

new_max

(optional_numeric) New maximum value. Default: 1

old_min

(optional, numeric) Old minimum value. Default: NULL

old_max

(optional_numeric) Old maximum value. Default: NULL

Value

zoo object

Examples

x <- zoo_simulate(cols = 2)

y <- f_rescale(
  x = x,
  new_min = 0,
  new_max = 100
)

if(interactive()){
  zoo_plot(x)
  zoo_plot(y)
}