R/int2bin.R

Defines functions i2b int2bin

Documented in i2b int2bin

#' Integer to Binary
#' 
#' @param integer input integer
#' @param length binary representation length
#' @return binary representation
#' @export

int2bin <- function(integer, length=8) {
  t(sapply(integer, i2b, length=length))
}


#' @describeIn int2bin individual Integer to Binary

i2b <- function(integer, length=8){
  as.numeric(intToBits(integer))[1:length]
}

Try the rnn package in your browser

Any scripts or data that you put into this service are public.

rnn documentation built on April 22, 2023, 1:12 a.m.