Skip to contents

This function returns the nth last characters of a string

Usage

substr_right(x, n)

Arguments

x

character

n

number of digits to extract starting from the right

Value

last nth character of x

Examples

vars <- c("Gender.x", "Gender.y")
vars |> substr_right(1)
#> [1] "x" "y"