SplitToDummy | R Documentation |
Split the strings of a character vector, put together all the unique pieces and return a matrix of dummy vectors for each single value.
SplitToDummy(x, split = ",", ...)
x |
character vector, each element of which is to be split. Other inputs, including a factor, will give an error. |
split |
character vector (or object which can be coerced to such) containing regular expression(s) (unless |
... |
the dots are passed on to |
a data.frame containing x
and all the found dummy vectors
Andri Signorell <andri@signorell.net>
strsplit
d.frm <- data.frame(id=1:5, txt=c("A,C,D", "A","B,C","D","D,E"))
SplitToDummy(d.frm$txt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.