first_char: Extract the first character from a string

Description Usage Arguments Value Examples

View source: R/utils.R

Description

This helper function will extract the first character from a string. The element may be a letter, number, or special character but will be coerced to a character vector in the output.

Usage

1
first_char(string)

Arguments

string

Character vector from which the first character will be extracted

Value

Character vector with the first character from each element in the vector passed to the input "string" argument. This value will be the same length as the original vector.

Examples

1
2
3
first_char("purple")
first_char(c("purple","rain"))
first_char(c("nothing","compares","2u"))

acroname documentation built on Jan. 25, 2021, 9:06 a.m.