splitUnnest | R Documentation |
Convenience function for splitting a column at a delimiter, unnesting (one row per value after splitting) and removing unnecessary whitespace. Default is to split at brackets. Returns a tibble tbl_df.
splitUnnest(
df,
ab = "Antigen",
split = "[\\(\\)]",
new_col = NA,
exclude = NA
)
df |
A data.frame or tibble |
ab |
(character(1), default "Antigen) Name of the column to remove prefixes from |
split |
(character(1), default "[\(\)]") A regular expression for using with strsplit. The default expression splits at "(" or ")". |
new_col |
(character(1), default NA Name of the column to add to df. If NA, column ab is modified. |
exclude |
(character(1), default NA) a regex - do not split if ab matches. |
df <- data.frame(Antigen = c("CD279 (PD-1)", "Mac-2 (Galectin-3)"))
splitUnnest(df, "Antigen", new_col = "Split")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.