Learn R Programming

splitstackshape (version 1.4.8)

concat.split.multiple: Split Concatenated Cells and Optionally Reshape the Output

Description

This is a wrapper for the cSplit() function to maintain backwards compatibility with earlier versions of the "splitstackshape" package. It allows the user to split multiple columns at once and optionally convert the results into a "long" format.

Usage

concat.split.multiple(data, split.cols, seps = ",", direction = "wide",
  ...)

Arguments

data

The source data.frame or data.table.

split.cols

A vector of columns that need to be split.

seps

A vector of the separator character used in each column. If all columns use the same character, you can enter that single character.

direction

The desired form of the resulting data.frame or data.table, either "wide" or "long". Defaults to "wide".

Other arguments to cSplit().

Value

A data.table.

See Also

cSplit()

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
temp <- head(concat.test)
concat.split.multiple(temp, split.cols = c("Likes", "Hates", "Siblings"),
                      seps = c(",", ";", ","))
concat.split.multiple(temp, split.cols = c("Likes", "Siblings"),
                      seps = ",", direction = "long")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab