dec2base | R Documentation |
dec2base
converts an integer from decimal (i.e., base 10) notation
into a sequence of numeric symbols (digits) of some other base.
dec2base(x, base = 2, as_char = TRUE)
x |
A (required) integer in decimal (base 10) notation or corresponding string of digits (i.e., 0-9). |
base |
The base of the symbols in |
as_char |
Return result as character string?
Default: |
To prevent erroneous interpretations of numeric outputs,
dec2base
returns a sequence of digits (as a character string).
When using as_char = FALSE
, its output string is
processed by as.integer
, but this may cause
problems with the interpretation of the numeric value
(as outputs for bases other than 10 do NOT denote decimal numbers)
and scientific notation.
dec2base
is the complement of base2dec
.
A string of digits (in base notation).
base2dec
converts numbers from some base into decimal numbers;
as.roman
converts integers into Roman numerals.
Other numeric functions:
base2dec()
# (a) single numeric input:
dec2base(3) # base = 2
dec2base(4)
dec2base(8)
dec2base(8, base = 3)
dec2base(8, base = 7)
dec2base(100, base = 2)
dec2base(100, base = 5)
dec2base(100, base = 10)
# (b) single string input:
dec2base("7", base = 2)
dec2base("8", base = 3)
# Note:
base2dec(dec2base(012340, base = 5), base = 5)
dec2base(base2dec(043210, base = 5), base = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.