Extract data from another variable using R




I have been gone through one problem on last assingment. I needed to split category tree and compare with another variable and which are similar I need to extract that information. but i was not able to do because in this uneven tree if I split tree directly by strsplit function it will give extra observatiojn in new columns.

               ` Item_summary            Defective_items`

                       `{rock: 49}                   Rock`

            `{paper: 10, rock: 41}                  Paper'

                     `  {paper: 38}                   Paper'

     `{scissor: 25, paper: 43, rock: 49}             Rock'

                     ` {paper: 18}                      Paper'

         {scissor: 32, paper: 18}                         scissor'

Now I want to split Item_summary tree and extract data according to Defective_Items
I want output as follows:

             ` Item_summary                 Defective_items               Defected_Items_cust`

                       `{rock: 49}                   rock                         Rock:49`

            {paper: 10, rock: 41}                   paper'                          paper:10

                       {paper: 38}                   paper'                        paper:38

     {scissor: 25, paper: 43, rock: 49}              rock'                          rock:49

                     {paper: 18}                     paper'                      paper:18

         {scissor: 32, paper: 18}                   scissor                     scissor:32

Can anyone help me how can I do it in R?

I tried grap command but it was didn’t work

Thanks in Advance