binary: Treating binary and g-adic numbers In compositions: Compositional Data Analysis

Usage

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 binary(x,mb=max(maxBit(x,g)),g=2) unbinary(x,g=2) bit(x,b,g=2) ## S3 method for class 'numeric' bit(x,b=0:maxBit(x,g),g=2) ## S3 method for class 'character' bit(x,b=0:maxBit(x,g),g=2) bit(x,b,g=2) <- value ## S3 replacement method for class 'numeric' bit(x,b=0:maxBit(x,g),g=2) <- value ## S3 replacement method for class 'character' bit(x,b=0:maxBit(x,g),g=2) <- value maxBit(x,g=2) ## S3 method for class 'numeric' maxBit(x,g=2) ## S3 method for class 'character' maxBit(x,g=2) bitCount(x,mb=max(maxBit(x,g)),g=2) gsi.orSum(...,g=2) whichBits(x,mb=max(maxBit(x,g)),g=2,values=c(TRUE)) binary2logical(x,mb=max(maxBit(x,g)),g=2,values=c(TRUE))

Arguments

 x a number either represented a g-adic character string or as a integeral numeric value b the indicies of the bits to be processes. The least significant bit has index 0. mb maximal bit. The index of the most significant bit to be treated g the base of the g-adic representation. 2 corresponds to binary numbers, 8 to octal numbers, 16 to hexadecimal numbers. g is limited by 36. value a vector of bit values to be selected or setted. values a vector of bit values that should be considered as TRUE. ... some binary numbers

Details

These routines are primerily intended to manipulate g-adic numbers for user interface purposes and condensed representation of information. They are not intended for a long number arithmetic.

Value

 binary returns a standard binary (or g-adic) character representation of the number unbinary returns a binary (or g-adic) representation of the number bit returns the values of the requested bits. The values are returned as a logical vector for binary numbers an as numeric digit values for other g-adic numbers. maxBit returns the most significant bit represented in the number. This is the highest bit set in numeric numbers and the highest actually given character in a character representation. bitCount returns the g-adic crossfoot of the number. For a binary number this is the number of bits set gsi.orSum Only works for binary numbers and does a parallel or on each of the bits for a list of binary numbers. whichBits returns the indices of the bits acutally set (or more precisely of the bits with value in values) binary2logical returns the a true false vector of the bits acutally set (or more precisely of the bits with value in values)

Author(s)

K.Gerald v.d. Boogaart http://www.stat.boogaart.de