str_left: Returns a substring from the beginning of a specified string

View source: R/str_left.R

str_leftR Documentation

Returns a substring from the beginning of a specified string

Description

Given a character vector, str_left() returns the left side of a string.

Usage

str_left(string, n = 1)

Arguments

string

The character from which the left portion will be returned.

n

Optional. The number of characters to return from the left side of string

Value

A character vector

See Also

str_right() which extracts characters from the right and str_mid() which returns a segment of character strings.

Examples

str_left("Nigeria")
str_left("Nigeria", n = 3)
str_left(c("Female", "Male", "Male", "Female"))


forstringr documentation built on Aug. 7, 2023, 5:08 p.m.