kth_digit: String Methods

Description Usage Arguments Value Examples

View source: R/strings.R

Description

Extract the k-th digit (if available) from the characters of a string.

Usage

1
kth_digit(string, k = 1L)

Arguments

string

An object that inherits from class "character".

k

Integer specifying which digit to extract.

Value

Returns the k-th digit (0-9) or NA if at least k digits are not found.

Examples

1
2
kth_digit("abc0def7ghi5")
kth_digit("abc0def7ghi5", k = 2)

bgreenwell/bmisc documentation built on Sept. 24, 2019, 11:09 a.m.