R: Convert a vector of integers representing digits in an...

digits2number {vipor} | R Documentation

## Convert a vector of integers representing digits in an arbitrary base to an integer

### Description

Takes a vector of integers representing digits in an arbitrary base e.g. binary or octal and converts it into an integer (or the integer divided by base^length(digits) for the number of digits if fractional is TRUE). Note that the first digit in the input is the least significant.

### Usage

    digits2number(digits, base = 2, fractional = FALSE)

### Arguments

`digits` | a vector of integers representing digits in an arbitrary base
`base` | the base for the numeral system (e.g. 2 for binary or 8 for octal)
`fractional` | divide the output by the max for this number of digits and base. Note that this is `base^length(digits)` not `base^length(digits)-1`.

### Value

an integer

### References

https://en.wikipedia.org/wiki/Radix

### Examples

    digits2number(c(4,4,1),8)
    digits2number(number2digits(100))

[Package vipor version 0.4.5 Index]