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).
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()
any object
a vmode from .vmode
The …
don't have a function yet, they are only defined to keep the generic flexible.
vmode
returns a character scalar from .vmode
or "NULL" for NULL
rambytes
returns a vector of byte counts required by each of the vmodes
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 |
# NOT RUN {
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