0

I have a dataset of the following structure:

df

Id    Name          Score
sec1  AI, ML          1
sec2  KI, OL, LP      3
sec3  OM, LI          9

I would like to reshape my dataset to get the following structure:

df

Id   Name Score
sec1 AI    1
sec1 ML    1
sec2 KI    3
sec2 OL    3
sec2 LP    3
sec3 OM    9
sec3 LI    9

To replicate the above example, you can use the df below:

df <- data.frame(Id = c("sec1","sec2","sec3"), Name = c( "AI, ML", "KI, OL, LP", "OM, LI"), Score = c(1,3,9))

Any Idea would be appreciated!

And_R
  • 1,647
  • 3
  • 18
  • 32

0 Answers0