1

I am facing a problem in restructuring my dataset. I have a dataset in the following form:

Key Color
1   blue
2   yellow
3   red, white
4   purple
5   tan, blue, black

However, I need to restructure it to the below form:

Key Color
1   blue
2   yellow
3   red
3   red
4   purple
5   tan
5   blue
5   black

I am new to R programming so unable to understand which function to use. Please help.

Bill Hileman
  • 2,798
  • 2
  • 17
  • 24
  • I think `cSplit` is the simplest to use, among the options in the link https://stackoverflow.com/a/28291428/ like `csplit(DF, "Color", ", ", direction = "long")` though it does require a package. – Frank Sep 24 '18 at 18:12

0 Answers0