
Takes a column in a data.frame
or data.table
with multiple values, splits
the values into a list
, and returns a new data.frame
or data.table
.
cSplit_l(data, split.col, sep = ",", drop = FALSE, fixed = FALSE)
The source data.frame
or data.table
.
The variable that needs to be split (either name or index position).
The character separating each value. Can also be a regular expression.
Logical. Should the original variable be dropped? Defaults to FALSE
.
Used for base::strsplit()
for allowing regular expressions to
be used.
A data.frame
or data.table
with the concatenated column split and
added as a list
.
# NOT RUN {
temp <- head(concat.test)
str(cSplit_l(temp, "Likes"))
cSplit_l(temp, 4, ";")
## The old function name still works
str(concat.split.list(temp, "Likes"))
concat.split.list(temp, 4, ";")
concat.split.list(temp, 4, ";", drop = TRUE)
# }
Run the code above in your browser using DataLab