Learn R Programming

bit (version 4.5.0)

clone: Cloning ff and ram objects

Description

clone physically duplicates objects and can additionally change some features, e.g. length.

Usage

clone(x, ...)

# S3 method for default clone(x, ...)

Value

an object that is a deep copy of x

Arguments

x

x an R object

...

further arguments to the generic

Methods (by class)

  • clone(default): default method uses R's C-API 'duplicate()'

Author

Jens Oehlschlägel

Details

clone is generic. clone.default handles ram objects. Further methods are provided in package 'ff'. still.identical returns TRUE if the two atomic arguments still point to the same memory.

See Also

clone.ff, copy_vector

Examples

Run this code

  x <- 1:12
  y <- x
  still.identical(x,y)
  y[1] <- y[1]
  still.identical(x,y)
  y <- clone(x)
  still.identical(x,y)
  rm(x,y); gc()

Run the code above in your browser using DataLab