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

update.ff

Update ff content from another object


Description

update copies updates one ff object with the content of another object.

Usage

## S3 method for class 'ff'
update(object, from, delete = FALSE, bydim = NULL, fromdim = NULL
, BATCHSIZE = .Machine$integer.max, BATCHBYTES = getOption("ffbatchbytes")
, VERBOSE = FALSE, ...)
## S3 method for class 'ffdf'
update(object, from, ...)

Arguments

object

an ff object to which to update

from

an object from which to uodate

delete

NA for quick update with file-exchange, TRUE for quick update with deleting the 'from' object after the update, can speed up updating significantly

bydim

how to interpret the content of the object, see ff

fromdim

how to interpret the content of the 'from' object, see ff

BATCHSIZE

BATCHSIZE

BATCHBYTES

BATCHBYTES

VERBOSE

VERBOSE

...

further arguments

Details

If the source object is.ff and not delete=FALSE then instead of slow copying we - if possible - try to swap and rename the files behind the ff objects. Quick update requires that the two ff objects are vectorCompatible, that both don't use vw, that they have identical maxlength and identical levels.ff.

Value

An ff object like the input 'object' updated with the content of the 'from' object.

Note

You don't have a guarantee that with delete=TRUE the 'from' object gets deleted or with delete=NA the 'from' objects carries the content of 'object'. Such expectations only turn true if really a quick update was possible.

Author(s)

Jens Oehlschlägel

See Also

Examples

x <- ff(1:100)
  y <- ff(-(1:100))
  message("You should make it a habit to re-assign the return value 
of update although this is not needed currently.")
  x <- update(x, from=y)
  x
  y
  x[] <- 1:100
  x <- update(x, from=y, delete=NA)
  x
  y
  x <- update(x, from=y, delete=TRUE)
  x
  y
  x
  rm(x,y); gc()

  ## Not run: 
    message("timings")
    x <- ff(1:10000000)
    y <- ff(-(1:10000000))
    system.time(update(x, from=y))
    system.time(update(y, from=x, delete=NA))
    system.time(update(x, from=y, delete=TRUE))
    rm(x,y); gc()
  
## End(Not run)

ff

Memory-Efficient Storage of Large Data on Disk and Fast Access Functions

v4.0.4
GPL-2 | GPL-3 | file LICENSE
Authors
Daniel Adler [aut], Christian Gläser [aut], Oleg Nenadic [aut], Jens Oehlschlägel [aut, cre], Martijn Schuemie [aut], Walter Zucchini [aut]
Initial release
2020-10-13

We don't support your browser anymore

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