README.md

uint8 - An 8-bit unsigned integer type for R

Rationale

Installation

devtools::install_github('coolbutuseless/uint8')

Features

Limitations

Comparison to raw

Examples

b02 <- as.uint8(  2)
b0a <- as.uint8( 10)
bff <- as.uint8(255)


# Addition is modulo 256
bff + b0a   # (255 + 10) %% 256 => 9
## [1] 9
# Division result trucated to integer value
b0a/b02   # 10/2 => 5
## [1] 5
bff/b0a   # 255/10 => 25.5 => 25
## [1] 25
# exponentiation is modulo 256
b02 ^ b0a   # 2^10 => 1024.    1024 %% 256 => 0
## [1] 0
# initialisation is modulo 256
as.uint8(seq(200, 300, 5))
##  [1] 200 205 210 215 220 225 230 235 240 245 250 255   4   9  14  19  24
## [18]  29  34  39  44

Future



coolbutuseless/uint8 documentation built on May 29, 2019, 11:04 p.m.