R/to.binary.R

Defines functions to.binary

Documented in to.binary

to.binary <- function(n, k = ceiling(logb(n+1,base=2))) {
x1 <- paste(rev(as.integer(intToBits(n))), collapse="")
x2 <- rev(as.integer(unlist(strsplit(sub("^0+", "", x1), NULL))))
c(x2, rep(0, k-length(x2)))
}

Try the bestglm package in your browser

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

bestglm documentation built on March 26, 2020, 7:25 p.m.