strHead: Function that takes first n characters from a (vector of)...

strHeadR Documentation

Function that takes first n characters from a (vector of) character string(s)

Description

Function that takes first n characters from (vector of) character string(s).

Usage

strHead(
	string,
	n_char=1)

Arguments

string

Character string or vector of character strings.

n_char

Number of characters to take from the head (starting at the first character) of the string (or vector of strings. Defaults to 1)

Details

Typical use of the function is return just the first few characters of a character string.

Value

Function returns a character string (vector) consisting of the first n_char of the character string (vector of character strings).

Author(s)

Damian W. Betebenner dbetebenner@nciea.org

Examples

strHead(state.name, 2) ### First two characters of each state name


CenterForAssessment/packageSkeletonForR documentation built on April 24, 2022, 7:54 p.m.