Learn R Programming

jjb (version 0.1.1)

char_at: 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.

Examples

Run this code
# NOT RUN {
# Example string
s = "statistics"

# Single character
char_at(s, 1)

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

Run the code above in your browser using DataLab