firstdigit | R Documentation |
Find the first or last digit in the decimal representation of a number.
firstdigit(x)
lastdigit(x)
ndigits(x)
x |
A numeric value or numeric vector. |
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.
An integer or integer vector of the same length as x
.
rounding
firstdigit(42)
lastdigit(42)
ndigits(42)
firstdigit(-0.1234)
lastdigit(-0.1234)
ndigits(-0.1234)
firstdigit(0)
lastdigit(0)
ndigits(0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.