Note that there are some explanatory texts on larger screens.

plurals
  1. POConverting R vectors into XML attribute Values
    primarykey
    data
    text
    <p>I am investigating creating XML trees based on R objects using the XML package.</p> <p>One thing I would like to do is extract information from data frames like the following:</p> <pre><code>frame2 rules support confidence lift 1 1 0.010230179 1.0000000 78.200000 2 2 0.010230179 0.8000000 78.200000 3 3 0.010230179 1.0000000 65.166667 4 4 0.010230179 0.6666667 65.166667 5 5 0.012787724 0.8333333 54.305556 6 6 0.012787724 0.8333333 54.305556 7 7 0.010230179 0.6666667 26.066667 8 8 0.010230179 0.4000000 26.066667 9 9 0.007672634 0.6000000 26.066667 10 10 0.007672634 0.3333333 26.066667 11 11 0.007672634 0.6000000 21.327273 12 12 0.007672634 0.2727273 21.327273 13 13 0.007672634 0.4285714 16.757143 14 14 0.007672634 0.3000000 16.757143 15 15 0.010230179 0.6666667 26.066667 16 16 0.010230179 0.4000000 26.066667 17 17 0.007672634 0.3333333 10.861111 18 18 0.007672634 0.2500000 10.861111 19 19 0.007672634 0.3750000 13.329545 20 20 0.007672634 0.2727273 13.329545 21 21 0.007672634 0.3750000 11.278846 22 22 0.007672634 0.2307692 11.278846 23 23 0.007672634 0.3750000 18.328125 24 24 0.007672634 0.3750000 18.328125 25 25 0.007672634 0.4285714 13.964286 26 26 0.007672634 0.2500000 13.964286 27 27 0.007672634 0.4285714 11.171429 28 28 0.007672634 0.2000000 11.171429 29 29 0.007672634 0.3000000 11.730000 30 30 0.007672634 0.3000000 11.730000 31 31 0.007672634 0.2727273 8.886364 32 32 0.007672634 0.2500000 8.886364 33 33 0.007672634 0.3333333 10.861111 34 34 0.007672634 0.2500000 10.861111 35 35 0.007672634 0.3000000 11.730000 36 36 0.007672634 0.3000000 11.730000 37 37 0.007672634 0.3000000 9.775000 38 38 0.007672634 0.2500000 9.775000 39 39 0.007672634 0.2727273 8.202797 40 40 0.007672634 0.2307692 8.202797 41 41 0.007672634 0.2307692 8.202797 42 42 0.007672634 0.2727273 8.202797 43 43 0.007672634 0.2307692 6.015385 44 44 0.007672634 0.2000000 6.015385 45 45 0.010230179 0.8000000 31.280000 46 46 0.010230179 1.0000000 65.166667 47 47 0.010230179 1.0000000 65.166667 </code></pre> <p>into XML trees like the following</p> <pre><code>root 1 support=0.010230179 confidence=1.0000000 lift=78.200000 /1 2 support=0.010230179 confidence=0.8000000 lift=78.200000 /2 47 support=0.010230179 confidence=1.0000000 lift=65.166667 /47 /root </code></pre> <p>So far, I have been able to create the 47 child nodes using the following commands.</p> <pre><code>root&lt;-newXMLNode("root") sapply(frame2$rules,newXMLNode,parent=root) </code></pre> <p>However, I have been unable to add the elements support, confidence, and lift with their appropriate values.</p> <p>Which leads me to asking the following 2 questions:</p> <ol> <li><p>How can I define either the elements or attributes support, confidence, and lift for each of the 47 child nodes?</p></li> <li><p>How can I fill in their respective values based off of the values present in frame2?</p></li> </ol> <p>Thank You Very Much.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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