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

as.ff.bit

Conversion between bit and ff boolean


Description

Function as.ff.bit converts a bit vector to a boolean ff vector. Function as.bit.ff converts a boolean ff vector to a ff vector.

Usage

## S3 method for class 'bit'
as.ff(x, filename = NULL, overwrite = FALSE, ...)
## S3 method for class 'ff'
as.bit(x, ...)

Arguments

x

the source of conversion

filename

optionally a desired filename

overwrite

logical indicating whether we allow overwriting the target file

...

further arguments passed to ff in case as.ff.bit, ignored in case of as.bit.ff

Details

The data are copied bot bit-wise but integerwise, therefore these conversions are very fast. as.bit.ff will attach the ff filename to the bit vector, and as.ff.bit will - if attached - use THIS filename and SILENTLY overwrite this file.

Value

A vector of the converted type

Note

NAs are mapped to TRUE in 'bit' and to FALSE in 'ff' booleans. Might be aligned in a future release. Don't use bit if you have NAs - or map NAs explicitely.

Author(s)

Jens Oehlschlägel

See Also

Examples

l <- as.boolean(sample(c(FALSE,TRUE), 1000, TRUE))

  b <- as.bit(l)
  stopifnot(identical(l,b[]))
  b
  f <- as.ff(b)
  stopifnot(identical(l,f[]))
  f
  b2 <- as.bit(f)
  stopifnot(identical(l,b2[]))
  b2
  f2 <- as.ff(b2)
  stopifnot(identical(filename(f),filename(f2)))
  stopifnot(identical(l,f2[]))
  f
  rm(f,f2); 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.