smsdigit: The second most significant digits of numbers

Description Usage Arguments Details Value See Also Examples

View source: R/utils.R

Description

Obtain the second most significant digits of numbers in numeric vectors or matrices.

Usage

1

Arguments

x

A numeric vector or matrix.

Details

For each non-zero, non-missing element of x that is greater than or equal to 10, smsdigit returns the second digit of that number's floating point representation of base 10. NA values in x generate NA values in the output of smsdigit.

Value

smsdigit returns a numeric vector with length equal to the number of elements of x that are greater than or equal to 10 plus the number of NA values in x.

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
smsdigit(451)
smsdigit(0.00451)
smsdigit(-0.00451)
smsdigit(c(-31.12, -0.23, 0.1234, 5.32))

x <- c(11, 22, 33, NA)
length(x)
length(smsdigit(x)) # equal to length(x)

x <- c(0, 1, 2,  10, 20)
length(x)
length(smsdigit(x)) # not equal to length(x)

pedro-teles-fonseca/daubl documentation built on Sept. 24, 2020, 7:31 a.m.