char_at: Character at Position _i_

View source: R/strs.R

char_atR Documentation

Character at Position i

Description

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(s)

James J Balamuta

Examples

# Example string
s = "statistics"

# Single character
char_at(s, 1)

# Vectorized position
char_at(s, c(2, 3))

coatless/balamuta documentation built on Nov. 16, 2023, 5:30 a.m.