encode4int | R Documentation |
The function encode4int converts each element in a given integer vector to a binary number.
encode4int(x, M, ...)
x |
A vector containing integer numbers |
M |
A vector containing the number of bits in the binary representation of each integer variable. |
... |
Further arguments passed to or from other methods. |
This function converts each element in the integer vector passed with the x argument to a binary number. The M argument refers to the number of bits in the binary representation of each integer variable.
A vector of binary representation of input vector
Zeynel Cebeci & Erkut Tekeli
decode4int
,
calcM
n = 5 lb = c(0, 0, 0) ub = c(10, 10, 10) set.seed(1) intmat = matrix(round(runif(3*n, lb, ub)), nr=n, nc=3) colnames(intmat) = paste0("v",1:3) head(intmat) M = calcM(ub) M binmat = matrix(NA, nrow=n, ncol=sum(M)) for(i in 1:n) binmat[i,] = encode4int(intmat[i,], M=M) head(binmat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.