firstdigit {spatstat.univar}R Documentation

Digits in Decimal Representation

Description

Find the first or last digit in the decimal representation of a number.

Usage

firstdigit(x)
lastdigit(x)
ndigits(x)

Arguments

x

A numeric value or numeric vector.

Details

firstdigit(x) finds the first (most significant) digit, lastdigit(x) finds the last (least significant) digit, and ndigits(x) finds the number of digits, in the decimal representation of each entry of x. The decimal representation is truncated at the number of digits available for double precision numbers on the hardware, usually 15.

Value

An integer or integer vector of the same length as x.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au

See Also

rounding

Examples

firstdigit(42)
lastdigit(42)
ndigits(42)

firstdigit(-0.1234)
lastdigit(-0.1234)
ndigits(-0.1234)

firstdigit(0)
lastdigit(0)
ndigits(0)

[Package spatstat.univar version 3.0-0 Index]