title: How to extract a list data inside quote after unnest command
body: <p>First of all I have to change my question (I'm unable to post new question) so I'm hoping this new one will get some (+) votes to keep my capability in posting in SO. Apologize to SO community but I'm here trying to learn just like everybody else.
  I have an activity dataset that I'm using to create histogram for each activities. One column is "activity" and I need to extract the elements from the activity column, however it has 2 variables - <code>type</code> and <code>confidence</code>. </p>
  
  <pre><code>&gt;tail(df)
  timestampMs                                                         activity
  9104 1415996184265      IN_VEHICLE, UNKNOWN, ON_BICYCLE, STILL, 73, 23, 2, 2
  9105 1415996140727                UNKNOWN, IN_VEHICLE, ON_BICYCLE, 71, 27, 2
  9106 1415996055604                                              TILTING, 100
  9107 1415995996249 UNKNOWN, ON_BICYCLE, ON_FOOT, UNKNOWN, IN_VEHICLE, STILL, 46, 25, 17, 17, 8, 4
  9108 1415995854775                                              TILTING, 100
  9109 1415995976124                                              TILTING, 100
  </code></pre>
  
  <p>I used <code>lapply</code> and it would list and arrange the values shown below.</p>
  
  <pre><code>&gt; df$activity &lt;- lapply(df$activity, function(x) as.data.frame(t(x)))
  &gt; tail(df$activity)
  [[1]]
                      1       2          3     4
  type       IN_VEHICLE UNKNOWN ON_BICYCLE STILL
  confidence         73      23          2     2
  [[2]]
                   1          2          3
  type       UNKNOWN IN_VEHICLE ON_BICYCLE
  confidence      71         27          2
  
  [[3]]
                   1
  type       TILTING
  confidence     100
  
  [[4]]
                   1          2       3       4          5     6
  type       UNKNOWN ON_BICYCLE ON_FOOT UNKNOWN IN_VEHICLE STILL
  confidence      46         25      17      17          8     4
  
  [[5]]
                   1
  type       TILTING
  confidence     100
  </code></pre>
  
  <p>Then I used the <code>unnest</code> function; </p>
  
  <pre><code>df2 &lt;- df %&gt;%
     transform(activity = str_split(activity, ",")) %&gt;%
     unnest(activity)
  </code></pre>
  
  <p>It list all elements in the <code>lapply</code> including the confidence variables (this is for the 4th element). </p>
  
  <pre><code> timestampMs                        activity
   1415995996249       list(type = c("UNKNOWN"
   1415995996249                  "ON_BICYCLE"
   1415995996249                     "ON_FOOT"
   1415995996249                     "UNKNOWN"
   1415995996249                  "IN_VEHICLE"
   1415995996249                     "STILL")
   1415995996249            confidence = c(46
   1415995996249                           25
   1415995996249                           17
   1415995996249                           17
   1415995996249                            8
   1415995996249                          4))
  </code></pre>
  
  <p>What I want is for each timestamp it will list the types (I'm using same timestamp). What is the best way to extract values inside double quotes and if there are no quotes like the last 6 lines I can just make it N/A or blank which can be easily filtered later on:</p>
  
  <pre><code>timestampMs            activity    
  1415995996249         "UNKNOWN"
  1415995996249      "ON_BICYCLE"
  1415995996249         "ON_FOOT"
  1415995996249         "UNKNOWN"
  1415995996249      "IN_VEHICLE"
  1415995996249           "STILL"
  </code></pre>