hex_dec_help: Convert non-negative whole numbers between decimal and...

View source: R/hexdec.R

hex_dec_helpR Documentation

Convert non-negative whole numbers between decimal and hexadecimal

Description

Convert non-negative whole numbers between decimal and hexadecimal

Usage

hex_dec_help()

to_dec(x)

to_hex(x)

todec(x)

tohex(x)

Arguments

x

A complete non-negative whole-number object (to_hex and tohex) or a complete character vec containing only non-negative whole-number hexademical values (to_dec or todec).

Functions

  • to_dec(): Convert hexadecimal numerals to decimal numerals. Returns a non-negative whole-number object.

  • to_hex(): Convert decimal numerals to hexadecimal numerals (not prefixed by '#'). Returns a character object of non-negative whole number hexadecimal values.

  • todec(): An alias for to_dec.

  • tohex(): An aliax for to_hex.

See Also

Other conversions: rng2lev(), tocase(), u2u_help()

Examples

egHexDec <- function() {
  RGBA   <- col2rgb("orange", alpha = 0.5)
  HEX1   <- rgb(RGBA[1] / 255, RGBA[2] / 255, RGBA[3] / 255, RGBA[4] / 255)
  HEX1   <- c(substr(HEX1, 2, 3), substr(HEX1, 4, 5), substr(HEX1, 6, 7), substr(HEX1, 8, 9))
  DEC1   <- to_dec(HEX1)
  HEX2   <- to_hex(DEC1)
  HEX12A <- tohex(12)
  DEC12A <- todec(HEX12A)
  HEX12B <- tohex(DEC12A)
  list(RGBA = RGBA, HEX1 = HEX2, HEX12A = HEX12A, HEX12B = HEX12B, DEC1 = DEC1, DEC12A = DEC12A)
}
egHexDec <- egHexDec()
egHexDec

j-martineau/uj documentation built on Sept. 14, 2024, 4:40 a.m.