Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As the structure of the <code>ul</code> is consistent, you can simply get each column individually (using only base R):</p> <pre><code>section &lt;- vapply(ul, function(x) as.numeric(x[[1]][2]), 0) field &lt;- vapply(ul, function(x) as.numeric(x[[2]][2]), 0) final_answer &lt;- vapply(ul, function(x) as.numeric(x[[3]][2]), 0) points &lt;- vapply(ul, function(x) as.numeric(x[[4]][2]), 0) </code></pre> <p>(Note, I use <code>vapply</code> instead of <code>sapply</code> as it is faster and reliably returns a vector, which is needed here).<br> Then you can simply put it all together:</p> <pre><code>&gt; data.frame(section, field, final_answer, points) section field final_answer points 1 1 1 1.000 0 2 1 2 1.000 1 3 1 3 0.611 1 </code></pre> <p>Note that I transformed everything into <code>numeric</code>. If you want to retain everything as characters, delete the <code>as.numeric</code> and exchange <code>0</code> with <code>""</code> in each call to <code>vapply</code>.</p> <hr> <p><strong>Late update:</strong></p> <p>There is actually a nice oneliner that extracts the complete data:</p> <pre><code>do.call("rbind", lapply(ul, function(x) as.numeric(vapply(x, "[", i = 2, "")))) </code></pre> <p>which gives: </p> <pre><code> [,1] [,2] [,3] [,4] [1,] 1 1 1.000 0 [2,] 1 2 1.000 1 [3,] 1 3 0.611 1 </code></pre> <p>to get the <code>colnames</code> use:</p> <pre><code>&gt; vapply(ul[[1]], "[", i = 1, "") param param param param "Section" "field" "final answer" "points" </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload