Expand row to multiple rows

You want flatten, I think.

julia> df=DataFrame(name=["aaa","bbbb","ccc"],
                           frqty=["apple\\4\\melon\\5","plume\\12","graphes\\7\\mango\\9\\persic\\11"])
3×2 DataFrame
 Row │ name    frqty                            
     │ String  String                           
─────┼──────────────────────────────────────────
   1 │ aaa     apple\\4\\melon\\5
   2 │ bbbb    plume\\12
   3 │ ccc     graphes\\7\\mango\\9\\persic\\11

julia> df.x = split.(df.frqty, "\\")
3-element Array{Array{SubString{String},1},1}:
 ["apple", "4", "melon", "5"]
 ["plume", "12"]
 ["graphes", "7", "mango", "9", "persic", "11"]

julia> flatten(df, :x)
12×3 DataFrame
 Row │ name    frqty                             x         
     │ String  String                            SubStrin… 
─────┼─────────────────────────────────────────────────────
   1 │ aaa     apple\\4\\melon\\5                apple
   2 │ aaa     apple\\4\\melon\\5                4
   3 │ aaa     apple\\4\\melon\\5                melon
   4 │ aaa     apple\\4\\melon\\5                5
   5 │ bbbb    plume\\12                         plume
   6 │ bbbb    plume\\12                         12
   7 │ ccc     graphes\\7\\mango\\9\\persic\\11  graphes
   8 │ ccc     graphes\\7\\mango\\9\\persic\\11  7
   9 │ ccc     graphes\\7\\mango\\9\\persic\\11  mango
  10 │ ccc     graphes\\7\\mango\\9\\persic\\11  9
  11 │ ccc     graphes\\7\\mango\\9\\persic\\11  persic
  12 │ ccc     graphes\\7\\mango\\9\\persic\\11  11
1 Like