to_decimal: Convert a Vector of Bits to a Decimal Number

View source: R/to_decimal.R

to_decimalR Documentation

Convert a Vector of Bits to a Decimal Number

Description

Converts a logical vector from binary to decimal. The bit vector may have any length, the last position is the least significant, i.e. bits are multiplied with 2^(n-1), 2^(n-2), ..., 2^1, 2^0 where n is the length of the bit vector.

Usage

to_decimal(bits)

Arguments

bits

(logical())
Logical vector of input values. Missing values are treated as being FALSE. If bits is longer than 30 elements, an exception is raised.

Value

(integer(1)).


mlr-org/mlr3misc documentation built on April 28, 2024, 11 p.m.