first_char {acroname}R Documentation

Extract the first character from a string

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

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


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


[Package acroname version 0.1.0 Index]