Closed yanbinghan closed 2 years ago
@yanbinghan I haven't tested your code yet, but what I realized in the code you posted is that you have a typo and of course it will not work:
truthTable(CVF, ...
should be changed to truthTable(VCF, ...
@mmahmoudian @dusadrian Oops. There was a typo. The code I was using is:
library(QCA) library(venn) data(CVF) obj <- truthTable(CVF, "PROTEST", incl.cut = 0.85) venn(obj, counts=TRUE)
But still, it's not showing up.
Hello @yanbinghan
As per the help file of function venn(): counts: A numerical vector of counts for each set intersection.
So the argument "counts" is not a logical one (as per your example) but it should be a numerical vector. In this case, for 5 sets it should have a length of 32.
You can take that vector from the truth table directly:
library(QCA)
library(venn)
obj <- truthTable(CVF, "PROTEST", incl.cut = 0.85, complete = TRUE)
obj$tt$n
# [1] 0 4 0 0 2 1 0 1 0 1 0 0 0 3 2 1 0 0 0 1 0 4 0 2 0 0 1 1 1 2 1 1
However, when the function venn() is presented a QCA truth table, it has a specific printing method for which counts are not important (I might change that in the future).
For the moment, you can get your counts diagram through:
venn(5, counts = obj$tt$n, snames = names(CVF)[1:5])
Hope this helps, Adrian
@dusadrian Thank you so much! It helps!
Just let you know for your future revision: I was using 'counts = TRUE' by following your [QCA book example] (https://bookdown.org/dusadrian/QCAbook/lkf.html#venn) above "Figure 11.12: Venn diagram for the CVF truth table". The code is 'venn(ttCVF, counts = TRUE, opacity = ttCVF$tt$incl)'. You may check it in your future revision. Thank you very much for your help. Best, Yanbing
Oh, you're right about that of course. The thing is, both packages venn and QCA have been considerably upgraded since the book was published, and this will be taken care of at the next edition of the book.
Otherwise, I am striving for backwards compatibility to the maximum extent possible and I'll also think about a solution in package venn to preserve the old code as well.
Thanks very much for bringing this up, Adrian
Dear Dr. Dusa,
I am use Venn after QCA. I want to have the counts for each set intersection show up. But it does not work. I am using the data(VCF) you provided . Here is my code:
Please let me know. Thank you very much. Best, Yanbing