Learn R Programming

ff (version 4.5.0)

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
# S3 method for default
vmode(x, ...)
# S3 method for ff
vmode(x, ...)
# S3 method for default
vmode(x) <- value
# S3 method for ff
vmode(x) <- value
 regtest.vmode()

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

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.

Author

Jens Oehlschlägel

Details

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

.vmodevirtual mode
.vunsignedTRUE if unsigned vmode
.vvaluesnumber of possible values (incl. NA)
.vimplementedTRUE if this vmode is available in ff (initialized .onLoad and stored in globalenv )
.rammodestorage mode of this vmode
.ffmodeinteger used to code the vmode in C-code
.vvaluesnumber of possible integers incl. NA in this vmode (or NA for other vmodes)
.vminmin integer in this vmode (or NA for other vmodes)
.vmaxmax integer in this vmode (or NA for other vmodes)
.vNANA or 0 if no NA for this vmode
.rambytesbytes needed in ram
.ffbytesbytes needed by ff on disk
.vcoerceablelist of vectors with those vmodes that can absorb this vmode

the following functions relate to vmode:

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

some of those call the vmode-specific functions:

creationcoercionvmode description
booleanas.boolean1 bit logical without NA
logicalas.logical2 bit logical with NA
quadas.quad2 bit unsigned integer without NA
nibbleas.nibble4 bit unsigned integer without NA
byteas.byte8 bit signed integer with NA
ubyteas.ubyte8 bit unsigned integer without NA
shortas.short16 bit signed integer with NA
ushortas.ushort16 bit unsigned integer without NA
integeras.integer32 bit signed integer with NA
singleas.single32 bit float
doubleas.double64 bit float
complexas.complex2x64 bit float
rawas.raw8 bit unsigned char
characteras.charactercharacter

See Also

Examples

Run this code
 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"]]

Run the code above in your browser using DataLab