BaseConversions: Converts Numbers From Binmode, Octmode or Hexmode to Decimal...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

These functions convert numbers from one base to another. There are several solutions for this problem out there, but the naming is quite heterogeneous and so consistent function names might be helpful.

Usage

1
2
3
4
5
6

Arguments

x

a vector of numbers, resp. alphanumerical representation of numbers (hex), to be converted.

Details

BinToDec converts numbers from binary mode into decimal values. DecToBin does it the other way round.
Oct means octal system and hex hexadecimal.

Value

A numeric or character vector of the same length as x containing the converted values. Binary, octal and decimal values are numeric, hex-values are returned as class hexmode.

Author(s)

Andri Signorell <andri@signorell.net>

See Also

strtoi

Examples

1
2
3
4
5
6
7
8
DecToBin(c(17, 25))
BinToDec(c(101, 11101))

DecToOct(c(17, 25))
OctToDec(c(11, 77))

DecToHex(c(17, 25))
HexToDec(c("FF", "AA", "ABC"))

AndriSignorell/DescTools documentation built on April 8, 2021, 5:51 a.m.