Learn R Programming

frt (version 0.1)

bin: Transform decimal into binary

Description

bin transforms a decimal number into a binary one in vectorial form.

Usage

bin(x)

Arguments

x
an integer

Value

Details

bin takes as input an integer and transforms it into the corresponding binary number. The output is a vector whose elements are the coefficients of increasing powers of 2, i.e., the ith item is the coefficient for $2^(i-1)$. For instance, bin(4) returns $(0,0,1)$.