R: Cloning ff and ram objects

clone {ff} | R Documentation

## Cloning ff and ram objects

### Description

`clone` physically duplicates ff (and ram) objects and can additionally change some features, e.g. length.

### Usage

    clone(x, ...)
    ## S3 method for class 'ff'
    clone(x
    , initdata = x
    , length = NULL
    , levels = NULL
    , ordered = NULL
    , dim = NULL
    , dimorder = NULL
    , bydim = NULL
    , symmetric = NULL
    , fixdiag = NULL
    , names = NULL
    , dimnames = NULL
    , ramclass = NULL
    , ramattribs = NULL
    , vmode = NULL
    , update  = NULL
    , pattern = NULL
    , filename = NULL
    , overwrite = FALSE
    , pagesize = NULL
    , caching = NULL
    , finalizer = NULL
    , finonexit = NULL
    , FF_RETURN = NULL
    , BATCHSIZE = .Machine$integer.max
    , BATCHBYTES = getOption("ffbatchbytes")
    , VERBOSE = FALSE
    , ...)
    ## S3 method for class 'list'
    clone(x, ...)
    ## Default S3 method:
    clone(x, ...)

### Arguments

`x` | `x`
`initdata` | scalar or vector of the `.vimplemented` `vmode`s, recycled if needed, default 0, see also `as.vmode` and `vector.vmode`
`length` | optional vector `length` of the object (default: derive from 'initdata' or 'dim'), see `length.ff`
`levels` | optional character vector of levels if (in this case initdata must be composed of these) (default: derive from initdata)
`ordered` | indicate whether the levels are ordered (TRUE) or non-ordered factor (FALSE, default)
`dim` | optional array `dim`, see `dim.ff` and `array`
`dimorder` | physical layout (default 1:length(dim)), see `dimorder` and `aperm`
`bydim` | dimorder by which to interpret the 'initdata', generalization of the 'byrow' paramter in `matrix`
`symmetric` | extended feature: TRUE creates symmetric matrix (default FALSE)
`fixdiag` | extended feature: non-NULL scalar requires fixed diagonal for symmetric matrix (default NULL is free diagonal)
`names` | see `names`
`dimnames` | NOT taken from initdata, see `dimnames`
`ramclass` | class attribute attached when moving all or parts of this ff into ram, see `ramclass`
`ramattribs` | additional attributes attached when moving all or parts of this ff into ram, see `ramattribs`
`vmode` | virtual storage mode (default: derive from 'initdata'), see `vmode` and `as.vmode`
`update` | set to FALSE to avoid updating with 'initdata' (default TRUE) (used by `ffdf`)
`pattern` | root pattern for automatic ff filename creation (default "ff"), see also `physical`
`filename` | ff `filename` (default tmpfile with 'pattern' prefix), see also `physical`
`overwrite` | set to TRUE to allow overwriting existing files (default FALSE)
`pagesize` | pagesize in bytes for the memory mapping (default from getOptions("ffpagesize") initialized by `getdefaultpagesize`), see also `physical`
`caching` | caching scheme for the backend, currently 'mmnoflush' or 'mmeachflush' (flush mmpages at each swap, default from getOptions("ffcaching") initialized with 'memorymap'), see also `physical`
`finalizer` | name of finalizer function called when ff object is `removed`, (default "deleteIfOpen" from getOptions("fffinalizer"))), standard finalizers are `close.ff`, `delete.ff` and `deleteIfOpen.ff`, see also `reg.finalizer`
`finonexit` | logical scalar determining whether finalizer is also called when R is closed via `q`, (default TRUE from getOptions("fffinonexit"))
`FF_RETURN` | logical scalar or ff object to be used. The default NULL creates a ff or ram clone, TRUE returns a ff clone, FALSE returns a ram clone. Handing over an ff object here uses this or stops if not `ffsuitable`
`BATCHSIZE` | integer scalar limiting the number of elements to be processed in `update.ff` when length(initdata)>1, default from getOption("ffbatchsize")
`BATCHBYTES` | integer scalar limiting the number of bytes to be processed in `update.ff` when length(initdata)>1, default from getOption("ffbatchbytes"), see also `.rambytes`
`VERBOSE` | set to TRUE for verbosing in `update.ff` when length(initdata)>1, default FALSE
`...` | further arguments to the generic

### Details

`clone` is generic. `clone.ff` is the workhorse behind `as.ram` and `as.ff`. For creating the desired object it calls `ff` which calls `update` for initialization.

### Value

an ff or ram object

### Author(s)

Jens Oehlschlägel

### See Also

`ff`, `update`, `as.ram`, `as.ff`

### Examples

      x <- ff(letters, levels=letters)
      y <- clone(x, length=52)
      rm(x,y); gc()

[Package ff version 2.2-13 Index]