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

number2digits

Convert an integer to an arbitrary base


Description

Takes an integer and converts it into an arbitrary base e.g. binary or octal. Note that the first digit in the output is the least significant.

Usage

number2digits(n, base = 2)

Arguments

n

the integer to be converted

base

the base for the numeral system (e.g. 2 for binary or 8 for octal)

Value

a vector of length ceiling(log(n+1,base)) respresenting each digit for that numeral system

References

Examples

number2digits(100)
number2digits(100,8)

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.