how to use tidyjson inside dplyr
<p>I have dataframe, called <code>data_df</code>, which has one column which contain json string, column name is <code>json_response</code>.</p>

<p>I want access very specific key-value from it. Example of one of json string as follows. I want to know how many times success is true in string.</p>

<pre><code>x = "[{\"s\":\"D\",\"success\":true,\"start.time\":\"2016-01-27 19:27:27\",\"stop.time\":\"2016-01-27 19:27:30\",\"status_code\":200,\"called\":true,\"milliseconds\":3738.6858,\"_row\":\"DataX\"},{\"s\":\"C\",\"success\":true,\"start.time\":\"2016-01-27 19:27:30\",\"stop.time\":\"2016-01-27 19:27:32\",\"status_code\":200,\"called\":true,\"milliseconds\":1815.1433,\"_row\":\"Clarity\"}]"
</code></pre>

<p>If I only want to use <code>tidyjson</code>, I can do it as follows, which works as I want. </p>

<pre><code>library(dplyr)
library(tidyjson) 
x %&gt;% gather_array %&gt;% 
    spread_values(called = jstring("called")) %&gt;% 
    summarize(x = sum(called == "TRUE"))
</code></pre>

<p>Now if I want to do it for whole column, how should I do it? I don't want to use a loop.</p>

<p>Following is my code which I tried to use.</p>

<pre><code>data_df %&gt;% 
    transmute(
              test =  json_response %&gt;% gather_array %&gt;% 
                  spread_values(called = jstring("called")) %&gt;% 
                  summarize(x = sum(called=="TRUE")) 
    )
</code></pre>

<p>Following is the error I got when I ran the above code:</p>

<blockquote>
<pre><code>Error: not compatible with STRSXP
</code></pre>
</blockquote>