Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There's probably a more elegant way to do this, but this ought to work: </p> <pre><code># here I'm generating some example data set.seed(5) topic_list1 &lt;- paste(sample(letters, 20, replace=T), sep=";") topic_list2 &lt;- paste(sample(letters, 15, replace=T), sep=";") # I don't make the tables right away tl1 &lt;- unlist(strsplit(topic_list1, split=";")) tl2 &lt;- unlist(strsplit(topic_list2, split=";")) big_list &lt;- unique(c(tl1, tl2)) # this computes your frequencies lbl &lt;- length(big_list) tMat1 &lt;- matrix(rep(tl1, lbl), byrow=T, nrow=lbl) tMat2 &lt;- matrix(rep(tl2, lbl), byrow=T, nrow=lbl) tMat1 &lt;- cbind(big_list, tMat1) tMat2 &lt;- cbind(big_list, tMat2) counts1 &lt;- apply(tMat1, 1, function(x){sum(x[1]==x[2:length(x)])}) counts2 &lt;- apply(tMat2, 1, function(x){sum(x[1]==x[2:length(x)])}) total_freqs &lt;- rbind(counts1, counts2, counts1-counts2) # this makes it nice looking &amp; user friendly colnames(total_freqs) &lt;- big_list rownames(total_freqs) &lt;- c("topics1", "topics2", "difference") total_freqs &lt;- total_freqs[ ,order(total_freqs[3,])] total_freqs d l a z b f s y m r x h n i g k c v o topics1 0 0 0 0 0 2 1 1 1 1 2 2 1 1 1 1 2 2 2 topics2 2 2 2 1 1 2 1 1 1 0 1 1 0 0 0 0 0 0 0 difference -2 -2 -2 -1 -1 0 0 0 0 1 1 1 1 1 1 1 2 2 2 </code></pre> <p>From there you could just use the straight numbers or visualize them however you want (e.g, dotplots, etc.). Here's a simple dotplot: </p> <pre><code>windows() dotchart(t(total_freqs)[,3], main="Frequencies of topics1 - topics2") abline(v=0) </code></pre> <p><img src="https://i.stack.imgur.com/vaOX1.png" alt="enter image description here"></p>
    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.
 

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