AutoSplit | R Documentation |
Creating variables by splitting the elements of a character vector without needing a split string
AutoSplit(
s,
split = NULL,
border = "_",
revBorder = FALSE,
noSplit = FALSE,
varNames = paste("var", 1:100, sep = ""),
tryReverse = TRUE
)
s |
The character vector |
split |
Split string. When NULL (default), automatic splitting without a split string. |
border |
A split character or an integer (move split) to be used when the exact split position is not unique. |
revBorder |
When border is integer the split position is moved from the other side. |
noSplit |
No splitting when TRUE. |
varNames |
Variable names of the created variables (too many is ok) |
tryReverse |
When TRUE, the automatic method tries to find more variables by splitting from reversed strings. |
A data frame with s as row names.
Øyvind Langsrud
s <- c("A12-3-A-x","A12-3-B-x","B12-3-A-x","B12-3-B-x",
"A12-3-A-y","A12-3-B-y","B12-3-A-y","B12-3-B-y")
AutoSplit(s)
AutoSplit(s,border="-")
AutoSplit(s,split="-")
AutoSplit(s,border=1)
AutoSplit(s,border=2)
AutoSplit(s,border=2,revBorder=TRUE)
AutoSplit(s,noSplit=TRUE)
AutoSplit(s,varNames=c("A","B","C","D"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.