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

getset.ff

Reading and writing vectors of values (low-level)


Description

The three functions get.ff, set.ff and getset.ff provide the simplest interface to access an ff file: getting and setting vector of values identified by positive subscripts

Usage

get.ff(x, i)
set.ff(x, i, value, add = FALSE)
getset.ff(x, i, value, add = FALSE)

Arguments

x

an ff object

i

an index position within the ff file

value

the value to write to position i

add

TRUE if the value should rather increment than overwrite at the index position

Details

getset.ff combines the effects of get.ff and set.ff in a single operation: it retrieves the old value at position i before changing it. getset.ff will maintain na.count.

Value

get.ff returns a vector, set.ff returns the 'changed' ff object (like all assignment functions do) and getset.ff returns the value at the subscript positions. More precisely getset.ff(x, i, value, add=FALSE) returns the old values at the subscript positions i while getset.ff(x, i, value, add=TRUE) returns the incremented values at the subscript positions.

Note

get.ff, set.ff and getset.ff are low level functions that do not support ramclass and ramattribs and thus will not give the expected result with factor and POSIXct

Author(s)

Jens Oehlschlägel

See Also

readwrite.ff for low-level access to contiguous chunks and [.ff for high-level access

Examples

x <- ff(0, length=12)
 get.ff(x, 3L)
 set.ff(x, 3L, 1)
 x
 set.ff(x, 3L, 1, add=TRUE)
 x
 getset.ff(x, 3L, 1, add=TRUE)
 getset.ff(x, 3L, 1)
 x
 rm(x); gc()

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.