library('dfexpand')
myDelimiter = ";"
# Create some fake data with duplicates
rows = c(
c("a;b"), c("a;b;c"), c("b;c"), c("d"), c("d")
)
# Add to a dataframe
df = data.frame(rows)
colnames(df) <- c("myvar")
#
# The default behavior is to trim extra whitespace from the extracted values,
# but not to alter or change the case of the values. So 'Alpha' is distinct from 'alpha'
# but ' beta ' is the same as 'beta'. You can override this behavior with
# the trim and ignore case flags.
#
expanded_df = expand_column(df, "myvar", myDelimiter)
Run the code above in your browser using DataLab