Validates a wide set-membership data frame and returns an hv_venn
object carrying a region-count table. Call plot.hv_venn on the
result for a bare ggplot2 Venn diagram. hv_venn() is the
small-set-count companion to hv_upset, reading the same input;
for more than three sets use hv_upset.
Value
An object of class c("hv_venn", "hv_data"):
$dataThe input data frame.
$metaNamed list:
sets,n_patients,n_sets.$tables$regionsA data frame with one logical column per set (the in/out membership pattern), a
regionlabel, andn(patients in that exact region).
See also
Worked recipe with rendered output: https://ehrlinger.github.io/hvti_graphics/upset.html.
Examples
dta <- sample_upset_data(n = 300, seed = 42)
v <- hv_venn(dta, sets = c("AV_Replacement", "MV_Replacement", "CABG"))
v$tables$regions
#> AV_Replacement MV_Replacement CABG region
#> 1 TRUE FALSE FALSE AV_Replacement only
#> 2 FALSE TRUE FALSE MV_Replacement only
#> 3 TRUE TRUE FALSE AV_Replacement & MV_Replacement
#> 4 FALSE FALSE TRUE CABG only
#> 5 TRUE FALSE TRUE AV_Replacement & CABG
#> 6 FALSE TRUE TRUE MV_Replacement & CABG
#> 7 TRUE TRUE TRUE AV_Replacement & MV_Replacement & CABG
#> n
#> 1 82
#> 2 42
#> 3 0
#> 4 100
#> 5 11
#> 6 3
#> 7 0