Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

digits2number

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

Examples

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

vipor

Plot Categorical Data Using Quasirandom Noise and Density Estimates

v0.4.5
GPL (>= 2)
Authors
Scott Sherrill-Mix, Erik Clarke
Initial release
2017-03-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.