Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

clone.DTSg

Clone Object


Description

Clones (copies) a DTSg object. Merely assigning a variable representing a DTSg object to a new variable does not result in a copy of the object. Instead, both variables will reference and access the same data in the background, i.e. changing one will also affect the other. This is not an issue when calling methods with the DTSgClone option or clone argument set to TRUE, but has to be kept in mind when setting fields, as they are always modified in place. See DTSg for further information.

Usage

## S3 method for class 'DTSg'
clone(x, deep = FALSE, ...)

Arguments

x

A DTSg object (S3 method only).

deep

A logical specifying if a deep copy is made (for consistency with R6Class the default is FALSE, but should generally be set to TRUE).

...

Not used (S3 method only).

Value

Returns a DTSg object.

See Also

Examples

# new DTSg object
x <- DTSg$new(values = flow)

# make a deep copy
## R6 method
x$clone(deep = TRUE)

## S3 method
clone(x = x, deep = TRUE)

DTSg

A Class for Working with Time Series Based on 'data.table' and 'R6' with Largely Optional Reference Semantics

v0.7.0
MIT + file LICENSE
Authors
Gerold Hepp [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.