digits {cwhmisc}R Documentation

Test, convert numbers

Description

Test, convert numbers

Usage

  allDigits( str, base=10 )
  isNumeric(str)
  str2dig( str )

Arguments

str

Vector of strings

base

Integer, base of number representation used in r2B

Value

allDigits The strings contain digits only which are allowable in base 'base'.
isNumeric Test whether the elements of a character vector represent legal numbers only.
str2dig Convert a string to a vector of integers.

Author(s)

Christian W. Hoffmann <christian@echoffmann.ch>

Examples

  allDigits(c("1231","89a8742")) #  TRUE FALSE
  isNumeric(c("1231","8.9e-2",".7d2")) # [1]  TRUE  TRUE FALSE
  str2dig("13245.") #  1 3 2 4 5 NA
    # for comparison, big numbers:
  int(10^(7:10)) # 10000000 100000000 1000000000 NA

[Package cwhmisc version 6.6 Index]