venndir_to_df: Convert venndir output to data.frame

venndir_to_dfR Documentation

Convert venndir output to data.frame

Description

Convert venndir output to data.frame or kable format for visual review.

Usage

venndir_to_df(
  venndir_out,
  df_format = c("hits", "items", "wide"),
  return_type = c("data.frame", "kable"),
  trim_blanks = TRUE,
  wrap_width = 80,
  colorize_headers = TRUE,
  set_colors = NULL,
  item_type = "gene",
  add_counts = TRUE,
  verbose = FALSE,
  ...
)

Arguments

venndir_out

list output from venndir()

df_format

character string, default "hits" with output format:

  • "hits" - returns a hit matrix, with the first column containing item labels, subsequent columns indicate "hits" with 0 or +1 or -1.

  • "items" - returns one column for each overlap, containing item labels in each corresponding column. This output does not include the sign.

  • "wide" - returns one row for each overlap_set/sign combination, and a column "items" which is a list of character vectors with the item labels. Rows may be split for "word wrapping" when there are too many items. This output is intended for kable() formatting with grouped rows, for example with argument return_type="kable".

return_type

character string indicating how to format output:

  • "kable": returns an object "knitr_kable" suitable for printing as HTML or LaTeX. This output is recommended for RMarkdown documents.

  • "data.frame": returns a data.frame object without colorization.

trim_blanks

logical whether to remove rows with 0 items.

wrap_width

numeric maximum width for item text before it is word-wrapped. To disable word-wrapping use wrap_width=Inf.

colorize_headers

logical indicating whether to color the background of each header by the set_colors.

...

additional arguments are ignored.

Details

Todo:

  • Accept input from signed_overlaps() for purely table summary.

Value

object of class "data.frame" or "knitr_kable" based upon argument return_type.

See Also

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

Examples

setlist <- venndir::make_venn_test(100, 3, do_signed=TRUE);
venndir_out <- venndir::venndir(setlist, overlap_type="each")
df <- venndir_to_df(venndir_out)
head(df, 10)

kdf <- venndir_to_df(venndir_out, return_type="kable")
kdf

df2 <- venndir_to_df(venndir_out, df_format="items")
head(df2, 10)

kdf2 <- venndir_to_df(venndir_out, df_format="items", return_type="kable")
kdf2

df3 <- venndir_to_df(venndir_out, df_format="wide", return_type="data.frame")
df3

kdf3 <- venndir_to_df(venndir_out, df_format="wide", return_type="kable")
kdf3


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