get_nth_part | R Documentation |
Extracts the first (or nth) entry from each split.
get_nth_part(x, delimiter, entry_no)
x |
A character vector. |
delimiter |
A character to split by. |
entry_no |
A number indicating which part of split to return. |
A character vector containing parts
x <- c("2wk.1", "2wk.2", "2wk.3", "2wk.4", "2wk.5", "2wk.6", "2wk.7", "2wk.8", "2wk.9", "2wk.10")
# delimiter = "\." # double slashes are escape characters for special characters like "."
# entry_no = 1L
get_nth_part(x, "\\.", "\\.")
# The return value is c("2wk", "2wk", "2wk", "2wk", "2wk", "2wk", "2wk", "2wk", "2wk", "2wk", "2wk", "2wk")
get_nth_part(x, "wk", 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.