Learn R Programming

tsbox (version 0.4.1)

copy_class: Re-Class ts-Boxable Object

Description

Copies class attributes from an existing ts-boxable series. Mainly used internally.

Usage

copy_class(
  x,
  template,
  preserve.mode = TRUE,
  preserve.names = FALSE,
  preserve.time = FALSE,
  preserve.attr = TRUE
)

Value

a ts-boxable object of the same class as template, i.e., an object of class ts, xts, zoo, data.frame, data.table, tbl, tbl_ts, tbl_time, tis, irts or timeSeries.

Arguments

x

ts-boxable time series, an object of class ts, xts, zoo, zooreg, data.frame, data.table, tbl, tbl_ts, tbl_time, tis, irts or timeSeries.

template

ts-boxable time series, an object of class ts, xts, zoo, zooreg, data.frame, data.table, tbl, tbl_ts, tbl_time, tis, irts or timeSeries.

preserve.mode

should the mode the time column be preserved (data frame only)

preserve.names

should the name of the time column be preserved (data frame only)

preserve.time

should the values time column be preserved (data frame only)

preserve.attr

should the attributes of the value column be preserved (data frame only)

Details

Inspired by xts::reclass, which does something similar.

Examples

Run this code
copy_class(mdeaths, ts_tbl(fdeaths))

Run the code above in your browser using DataLab