Determines the position(s) of a given character in a string variable. If the character is absent, NA is returned.
The character to position of which needs to be determined
The function converts the string to a vector of characters. An alternative is to use which(strsplit(string, ”)[]=='a'), where a is the character. That code determines all positions of the character in the character string.
The position is returned
string <- "tests" pos.char(string,"s")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.