pos.char: Position of a given character in a string variable (first...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/pos.char.R

Description

Determines the position(s) of a given character in a string variable. If the character is absent, NA is returned.

Usage

1
pos.char(string, char)

Arguments

string

Character string

char

The character to position of which needs to be determined

Details

The function converts the string to a vector of characters. An alternative is to use which(strsplit(string, ”)[[1]]=='a'), where a is the character. That code determines all positions of the character in the character string.

Value

The position is returned

Author(s)

Frans Willekens

See Also

printf

Examples

1
2
string  <- "tests"
pos.char(string,"s")

Biograph documentation built on May 1, 2019, 8:48 p.m.