getWord | R Documentation |
This function takes a text string or a list of text strings and extracts a specific word based on its position, using a given pattern to split the text into words.
getWord(tosearch, item = 1, pattern = "\\W+")
tosearch |
The text string or list of text strings from which to extract the word. |
item |
The position of the word to extract (1-based index). Default is 1. |
pattern |
The pattern used to split the text string into words. Default is "\W+" (one or more non-word characters). |
A character string containing the extracted word if tosearch
is a single string,
or a list of extracted words if tosearch
is a list of strings.
getWord("aaa bb,cc.",3)
getWord("aaa-bb-cc",2,pattern="-")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.