separate_dt | R Documentation |
Given either regular expression,
separate_dt()
turns a single character column into two columns.
separate_dt(
.data,
separated_colname,
into,
sep = "[^[:alnum:]]+",
remove = TRUE
)
.data |
A data frame. |
separated_colname |
Column to be separated, can be a character or alias. |
into |
Character vector of length 2. |
sep |
Separator between columns. |
remove |
If |
separate
, unite_dt
df <- data.frame(x = c(NA, "a.b", "a.d", "b.c"))
df %>% separate_dt(x, c("A", "B"))
# equals to
df %>% separate_dt("x", c("A", "B"))
# If you just want the second variable:
df %>% separate_dt(x,into = c(NA,"B"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.