tests/testthat/test-ts_scale.R

test_that("ts_scale does not modify time column", {
  expect_equal(
    ts_c(AirPassengers, EuStockMarkets[, "DAX"])$time,
    ts_scale(ts_c(AirPassengers, DAX = EuStockMarkets[, "DAX"]))$time
  )
})

test_that("POSIXct time col does not get modified.", {
  ap <- ts_df(AirPassengers)
  ap$time <- as.POSIXct(ap$time)
  expect_s3_class(ts_scale(ap)$time, "POSIXct")
})

Try the tsbox package in your browser

Any scripts or data that you put into this service are public.

tsbox documentation built on May 31, 2023, 6:41 p.m.