Skip to contents

This function converts signed integer values into a vector of raw data.

Usage

signedIntToRaw(int_dat)

Arguments

int_dat

A vector of integer values, ranging from -128 up to 127.

Value

A vector of the same length as int_dat, holding raw data.

Details

This function converts signed integer values [-128,127] into a vector of raw data. The function will fail on values that are out of range (< -128 or > 127). To convert raw data into a vector of unsigned integers use as.integer(). For the inverse of this function see rawToSignedInt().

Author

Pepijn de Vries

Examples

## generate some signed integers:
some.integers <- c(-100, 40, 0, 30, -123)

## convert the signed integers into a vector of raw data:
signedIntToRaw(some.integers)
#> [1] 9c 28 00 1e 85