Learn R Programming

ff (version 4.0.4)

as.vmode: Coercing to virtual mode

Description

as.vmode is a generic that converts some R ram object to the desired vmode.

Usage

as.vmode(x, ...)
as.boolean(x, ...)
as.quad(x, ...)
as.nibble(x, ...)
as.byte(x, ...)
as.ubyte(x, ...)
as.short(x, ...)
as.ushort(x, ...)
# S3 method for default
as.vmode(x, vmode, …)
# S3 method for ff
as.vmode(x, …)
# S3 method for default
as.boolean(x, ...)
# S3 method for default
as.quad(x, ...)
# S3 method for default
as.nibble(x, ...)
# S3 method for default
as.byte(x, ...)
# S3 method for default
as.ubyte(x, ...)
# S3 method for default
as.short(x, ...)
# S3 method for default
as.ushort(x, ...)

Arguments

x

any object

vmode

virtual mode

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

Value

a vector of the desired vmode containing the input data

Details

Function as.vmode actually coerces to one of the usual storage.modes (see .rammode) but flags them with an additional attribute 'vmode' if necessary. The coercion generics can also be called directly:

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

See Also

vmode, vector.vmode

Examples

Run this code
# NOT RUN {
  as.vmode(1:3,"double")
  as.vmode(1:3,"byte")
  as.double(1:3)
  as.byte(1:3)
# }

Run the code above in your browser using DataLab