binvec2int: Convert a binary vector to an integer representation

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/r-utility-binary-integer.R

Description

This function converts a binary vector to the corresponding integer number using the natural binary code. It is used in examples presented in the book Cichosz, P. (2015): Data Mining Algorithms: Explained Using R. See Appendix B or http://www.wiley.com/go/data_mining_algorithms for more details.

Usage

1

Arguments

v

an integer vector of 0's and 1's

Details

The input argument is considered a binary code word, ordered from the least significant bits to the most significant bits, and converted to the corresponding integer number according to the natural binary code.

Value

An integer represented the input binary vector according to the natural binary code.

Author(s)

Pawel Cichosz <p.cichosz@elka.pw.edu.pl>

See Also

int2binvec

Examples

1
2
3
binvec2int(c(1, 1, 0, 1))
binvec2int(c(1, 1, 0, 1, 0))
binvec2int(c(1, 1, 0, 1, 1))

42n4/dmr.util documentation built on May 20, 2019, 2:02 p.m.