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

vmode

Virtual storage mode


Description

Function vmode returns virtual storage modes of 'ram' or 'ff' objects, the generic vmode<- sets the vmode of ram objects (vmode of ff objects cannot be changed).

Usage

vmode(x, ...)
vmode(x) <- value
## Default S3 method:
vmode(x, ...)
## S3 method for class 'ff'
vmode(x, ...)
## Default S3 replacement method:
vmode(x) <- value
## S3 replacement method for class 'ff'
vmode(x) <- value
 regtest.vmode()

Arguments

x

any object

value

a vmode from .vmode

...

The ... don't have a function yet, they are only defined to keep the generic flexible.

Details

vmode is generic with default and ff methods. The following meta data vectors can be queried by .vmode or .ffmode:

.vmode virtual mode
.vunsigned TRUE if unsigned vmode
.vvalues number of possible values (incl. NA)
.vimplemented TRUE if this vmode is available in ff (initialized .onLoad and stored in globalenv )
.rammode storage mode of this vmode
.ffmode integer used to code the vmode in C-code
.vvalues number of possible integers incl. NA in this vmode (or NA for other vmodes)
.vmin min integer in this vmode (or NA for other vmodes)
.vmax max integer in this vmode (or NA for other vmodes)
.vNA NA or 0 if no NA for this vmode
.rambytes bytes needed in ram
.ffbytes bytes needed by ff on disk
.vcoerceable list of vectors with those vmodes that can absorb this vmode

the following functions relate to vmode:

vector.vmode creating (ram) vector of some vmode
as.vmode generic for coercing to some vmode (dropping other attributes)
vmode<- generic for coercing to some vmode (keeping other attributes)
maxffmode determine lowest .ffmode that can absorb all input vmodes without information loss

some of those call the vmode-specific functions:

creation coercion vmode description
boolean as.boolean 1 bit logical without NA
logical as.logical 2 bit logical with NA
quad as.quad 2 bit unsigned integer without NA
nibble as.nibble 4 bit unsigned integer without NA
byte as.byte 8 bit signed integer with NA
ubyte as.ubyte 8 bit unsigned integer without NA
short as.short 16 bit signed integer with NA
ushort as.ushort 16 bit unsigned integer without NA
integer as.integer 32 bit signed integer with NA
single as.single 32 bit float
double as.double 64 bit float
complex as.complex 2x64 bit float
raw as.raw 8 bit unsigned char
character as.character character

Value

vmode returns a character scalar from .vmode or "NULL" for NULL
rambytes returns a vector of byte counts required by each of the vmodes

Note

regtest.vmode checks correctness of some vmode features

Author(s)

Jens Oehlschlägel

See Also

Examples

data.frame(.vmode=.vmode, .vimplemented=.vimplemented, .rammode=.rammode, .ffmode=.ffmode
, .vmin=.vmin, .vmax=.vmax, .vNA=.vNA, .rambytes=.rambytes, .ffbytes=.ffbytes)
  vmode(1)
  vmode(1L)
  .vcoerceable[["byte"]]
  .vcoerceable[["ubyte"]]

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.