Cloning of SSA objects

Share:

Description

Function to copy SSA objects

Usage

1
2
## S3 method for class 'ssa'
clone(x, copy.storage = TRUE, copy.cache = TRUE, ...)

Arguments

x

object to be cloned

copy.storage

enable/disable copying of the internal storage

copy.cache

enable/disable copying of the set of pre-cached elementary series

...

additional arguments to clone

Details

For the sake of memory efficiency SSA objects hold references to the data, not the data itself. That is why they can hold huge amount of data and passing them by value is still cheap.

However, this means that one cannot safely copy the object using normal assignment operator, since freeing of references in one object would yield stale references in another. The clone method provides safe ‘deep copy’ of SSA objects.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Decompose 'co2' series with default parameters
s <- ssa(co2);
# Perform 'normal copy' of SSA object
s1 <- s;
# Perform 'deep copy' of SSA object
s2 <- clone(s);
# Add some data to 's'
reconstruct(s);
# Now 's1' also contains this data, but 's2' - not
summary(s1);
summary(s2);

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.