Function that returns the last n characters from (vector of) character string(s).
strTail( string, n_char=1)
string | Character string or vector of character strings. |
---|---|
n_char | Number of characters to take from the tail (starting at the last character) of the string (or vector of strings). Defaults to 1. |
Typical use of the function is return just the last few characters of a character string.
Function returns a character string (vector) consisting of the last n_char of the character string (vector of character strings).
strTail(state.name, 2) ### Last two characters of each state name#> [1] "ma" "ka" "na" "as" "ia" "do" "ut" "re" "da" "ia" "ii" "ho" "is" "na" "wa" #> [16] "as" "ky" "na" "ne" "nd" "ts" "an" "ta" "pi" "ri" "na" "ka" "da" "re" "ey" #> [31] "co" "rk" "na" "ta" "io" "ma" "on" "ia" "nd" "na" "ta" "ee" "as" "ah" "nt" #> [46] "ia" "on" "ia" "in" "ng"