Extracting elements within curly brackets { } from a factor with several levels
<p>I received a data file in which one value is within curly brackets comprising several different values, like this:  </p>

<p>[1] {"Q0":"0","Q1":"1","Q2":"2","Q3":"3","Q4":"4","Q5":"6","Q6":"5","Q7":"4","Q8":"3"}</p>

<p>13 Levels:  ...</p>

<p>(Unfortunately I cannot provide an example as I do not know how to create this format.) </p>

<p>"Q0", "Q1" etc are different questions; and the values "0", "1", etc are the responses. I would like to create a data frame where "Q0", "Q1" are the column names and the values "0", "1", are numerical values.</p>

<p>But Im not sure how to extract the various parts. I have tried</p>

<pre><code> x[["Q0"]]
</code></pre>

<p>and</p>

<pre><code> getElement(x, "Q0")
</code></pre>

<p>Which gives: "Error in <code>[[.default</code>(x, "Q0") : subscript out of bounds"</p>

<p>Any help is much appreciated</p>