make_venn_test: Generate test sets for venndir

make_venn_testR Documentation

Generate test sets for venndir

Description

Generate test sets for venndir

Usage

make_venn_test(
  n_items = 1e+06,
  n_sets = 4,
  do_signed = FALSE,
  concordance = 0.5,
  min_size = ceiling(n_items/50),
  max_size = ceiling(n_items/2),
  items = NULL,
  sizes = NULL,
  seed = 123,
  item_prefix = "item_",
  ...
)

Arguments

n_items

integer total number of items available to all sets, also known as the universe size.

n_sets

integer number of sets that contain items.

do_signed

logical indicating whether to return signed sets, which indicate directionality with -1 or 1 values, named by the items.

concordance

numeric between -1 and 1, used when do_signed=TRUE. This value imposes an approximate amount of concordance between random pairs of sets, using the concordance equation: concordance = (agree - disagree) / (agree + disgree) where (agree + disagree) = n. This equation approximates the number of items that agree as: agree = ceiling((concordance * n + n) / 2).

min_size

integer minimum range of items that may be contained in each set.

max_size

integer maximum range of items that may be contained in each set.

items

vector or NULL that contains the universe of items. When items is defined, n_items is ignored.

sizes

vector of integer values, or NULL, indicating the size of each set. When sizes is defined, min_size and max_size is ignored. When sizes is defined, names(sizes) are used as names for each set.

seed

numeric or NULL used with set.seed() for data reproducibility. When seed=NULL then set.seed() is not called.

item_prefix

character string used as prefix for item names, default "item_".

...

additional arguments are ignored.

Details

This function generates data to use as test input to Venn diagram functions. It can generate sets of items, or signed sets (integer values -1, 1) named by item.

This function defines a range of set sizes, using min_size and max_size, with roughly square-root sequence of sizes between these two extremes.

Note that the universe size represents the total available items, but not necessarily the total number of items represented by the sets. For example, if n_items=1000000, max_size=500 and n_sets=3 then the maximum number of items actually represented is 1500.

The universe can be defined using optional argument items, which takes priority over n_items.

The specific size of each set can be defined with optional argument sizes, which takes priority over min_size, and max_size.

Value

list of items, either as a list of item vectors, or when do_signed=TRUE the list of vectors, where vector names contain the items, and vector values are signed values from c(-1, 1).

See Also

Other venndir utility: curate_venn_labels(), expand_range(), make_color_contrast(), make_venn_combn_df(), match_list(), modify_venndir_overlap(), nudge_venndir_label(), plot,Venndir,ANY-method, print_color_df(), shrink_df(), three_point_angle(), venndir_legender(), venndir_to_df()

Examples

## basic setlist without signed direction
setlist <- make_venn_test(n_items=100,
   n_sets=3,
   min_size=5,
   max_size=25)
set_im <- list2im_opt(setlist);
table(jamba::pasteByRow(as.matrix(set_im)*1))

## basic setlist with signed direction
setlist <- make_venn_test(n_items=100,
   n_sets=3,
   do_signed=TRUE)
jamba::sdim(setlist);

## some example overlap summaries
sv1 <- signed_overlaps(setlist=setlist, "overlap")
sv1

## Familiar named overlap counts
jamba::nameVector(sv1[,c("count","sets")])

## directional count table for each combination
sv2 <- signed_overlaps(setlist=setlist, "each")
sv2

## directional count table for agreement or mixed
sv3 <- signed_overlaps(setlist=setlist, "agreement")
sv3

## signed incidence matrix
imv <- list2im_value(setlist)
dim(imv)
head(imv)

## text venn diagram
textvenn(setlist, overlap_type="overlap")

## text venn diagram with signed direction
textvenn(setlist, overlap_type="each")


jmw86069/venndir documentation built on Dec. 14, 2024, 2:36 p.m.