substrRight: A Right-handed Substring Function

View source: R/substrRight_function.R

substrRightR Documentation

A Right-handed Substring Function

Description

This function returns a portion of a string, counted from the right-hand margin. Useful for strings of uneven length where the trailing digits are of interest. This function is similar to base::substr() except that the offset if counted from the right.

Usage

substrRight(x, n, k)

Arguments

x

a vector, if not a character vector, will be coerced using as.character

n

the number of elements from the right margin to start counting from

k

the number of elements to include in the resulting string

Examples

substr("abcdef", 2, 4)
substrRight(X, 3, 2)
X <- c(3846250)
substrRight(X, 4, 2)

JenC36/JACtools documentation built on Oct. 20, 2024, 8:05 a.m.