View source: R/str_extract_part.R
str_extract_part | R Documentation |
Vectorised over string and pattern.
str_extract_part(string, pattern, before = TRUE)
string |
A character vector. |
pattern |
Pattern to look for. |
before |
The position in the string to extract from. If TRUE, the extract will occur before the pattern; if FALSE, it will happen after the pattern. |
A subset of the input vector.
str_split_extract()
which splits up a string into pieces and extracts the results using a specified index position.
weekdays <- c(
"Monday_1", "Tuesday_2", "Wednesday_3", "Thursday_4",
"Friday_5", "Saturday_6", "Sunday_7"
)
str_extract_part(weekdays, before = TRUE, pattern = "_")
str_extract_part(c("$159", "$587", "$897"), before = FALSE, pattern = "$")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.