dec2bin: Decimal To Binary Conversion

Description Usage Arguments Details Value Examples

Description

dec2bin function converts a decimal number to a binary number.

Usage

1
dec2bin(vec, npos = NA)

Arguments

vec

a numeric vector of positive values.

npos

an optional number of length of the generating binary number.

Details

This is a function to converting from decimal to binary number.

Value

dec2bin returns a matrix.

Examples

1
2
3
binary <- dec2bin(zz <- sample(0:100, 10))
print(zz)
print(binary)

Example output

Loading required package: survival
 [1] 87 42 97 50 76 40 88 38 29 32
   64 32 16 8 4 2 1
87  1  0  1 0 1 1 1
42  0  1  0 1 0 1 0
97  1  1  0 0 0 0 1
50  0  1  1 0 0 1 0
76  1  0  0 1 1 0 0
40  0  1  0 1 0 0 0
88  1  0  1 1 0 0 0
38  0  1  0 0 1 1 0
29  0  0  1 1 1 0 1
32  0  1  0 0 0 0 0

HapEstXXR documentation built on May 1, 2019, 10:54 p.m.