Skip to contents

Returns the character at location i inside the string.

Usage

char_at(x, index)

Arguments

x

A character vector to extract position from.

index

An integer between 1 and length n.

Value

A character vector of length index.

Author

James J Balamuta

Examples

# Example string
s = "statistics"

# Single character
char_at(s, 1)
#> [1] "s"

# Vectorized position
char_at(s, c(2, 3))
#> [1] "t" "a"