Learn R Programming

ProTrackR (version 0.4.4)

unsignedIntToRaw: Convert unsigned integer into a raw vector

Description

This function converts an unsigned integer into a vector of raw data.

Usage

unsignedIntToRaw(int_dat, length.out = 1)

Value

A vector of length length.out, holding raw data.

Arguments

int_dat

A single integer value. If a list or vector of values. is provided, only the first element is evaluated. Input data are converted to absolute integer values.

length.out

Required length of the vector that will hold the resulting. raw data. Defaults to 1. If the value of int_dat is to large to convert into raw data of length length.out, data will be clipped.

Author

Pepijn de Vries

Details

This function converts an unsigned integer value into a vector (with a specified length, namely length.out) of raw data. For the inverse of this function use rawToUnsignedInt().

See Also

Other raw.operations: as.raw(), nybbleToSignedInt(), nybble(), rawToCharNull(), rawToPTModule(), rawToSignedInt(), rawToUnsignedInt(), signedIntToNybble(), signedIntToRaw()

Other integer.operations: nybbleToSignedInt(), nybble(), rawToSignedInt(), rawToUnsignedInt(), signedIntToNybble(), signedIntToRaw(), waveform()

Examples

Run this code
## generate some unsigned integer:
some.integer <- 43251

## convert the unsigned integer into raw data:
unsignedIntToRaw(some.integer, length.out = 4)

if (FALSE) {
## note that the integer is too large to store as raw with length.out = 1:
unsignedIntToRaw(some.raw.data, length.out = 1)
}

Run the code above in your browser using DataLab