Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

nybbleToSignedInt

Get signed integer values from nybbles


Description

Get signed integer values from one or more nybble.

Usage

nybbleToSignedInt(raw_dat, which = c("low", "high"))

Arguments

raw_dat

raw data (either a single value or a vector), from which a nybble will be extracted and converted.

which

A character string indicating whether the "low" (default) or "high" nybble of raw_dat needs to be converted into a signed integer.

Details

Nybbles are 4 bit values, where each byte (8 bits) holds two nybbles. A high nybble (left-hand side of a byte) and a low nybble (right-hand side of a byte). This function extracts a nybble from raw data and converts it into a signed integer value ranging from -8 up to 7.

Value

Returns integer values of the same length as raw_dat, ranging from -8 up to 7.

Author(s)

Pepijn de Vries

See Also

Other nybble.functions: nybble(), signedIntToNybble()

Examples

## generate some raw data:

rdat <- as.raw(255*runif(100))

## get signed integers of low nybbles:

sintl <- nybbleToSignedInt(rdat)

## get signed integers of high nybbles:

sinth <- nybbleToSignedInt(rdat, "high")

ProTrackR

Manipulate and Play 'ProTracker' Modules

v0.3.7
GPL-3
Authors
Pepijn de Vries [aut, cre, dtc]
Initial release
2020-02-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.