Given a character vector, str_left()
returns the left side of a string.
See also
str_right()
which extracts characters from the right and str_mid()
which returns a segment of character strings.
Examples
str_left("Nigeria")
#> [1] "N"
str_left("Nigeria", n = 3)
#> [1] "Nig"
str_left(c("Female", "Male", "Male", "Female"))
#> [1] "F" "M" "M" "F"