1

suppose I have a data.frame like this:

try= data.frame(name= c("a","b", "c","d", "e"), ID= c("123;345;444", "564;567", "891;456","789;987", "717;233"))

try
  name          ID
1    a 123;345;444
2    b     564;567
3    c     891;456
4    d     789;987
5    e     717;233

I would to separate the column ID as new rows in the data frame. The example is this one:

 result
   name  ID
1     a 123
2     a 345
3     a 444
4     b 564
5     b 567
6     c 891
7     c 456
8     d 789
9     d 987
10    e 717
11    e 233

My dataframe is bigger, with more columns, but I need to separate each number in ID duplicating all the other info..

jonny jeep
  • 383
  • 3
  • 12

0 Answers0