View source: R/01supporting_functions.r
| signedIntToNybble | R Documentation | 
This function converts a signed integer ranging from -8 up to 7 into
either the high or low nybble of a byte, represented by raw data.
signedIntToNybble(int_dat, which = c("low", "high"))
| int_dat | A single  | 
| which | A character string indicating whether the nybble should
be set to the  | 
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 converts a signed integer value
ranging from -8 up to 7 to a nybble and sets it as either a high or a low
nybble in raw data.
Returns raw data of the same length as int_dat.
The returned raw data holds either low or high nybbles (as specified
by which) based on the provided signed integers.
Pepijn de Vries
Other nybble.functions: 
nybbleToSignedInt(),
nybble()
Other raw.operations: 
as.raw(),
nybbleToSignedInt(),
nybble(),
rawToCharNull(),
rawToPTModule(),
rawToSignedInt(),
rawToUnsignedInt(),
signedIntToRaw(),
unsignedIntToRaw()
Other integer.operations: 
nybbleToSignedInt(),
nybble(),
rawToSignedInt(),
rawToUnsignedInt(),
signedIntToRaw(),
unsignedIntToRaw(),
waveform()
## generate some integers in the right range:
dati <- sample(-8:7, 100, replace = TRUE)
## Set the low nybbles of rawl based on dati:
rawl <- signedIntToNybble(dati)
## Set the high nybbles of rawl based on dati:
rawh <- signedIntToNybble(dati, "high")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.