print_color_df: Print colorized text table

print_color_dfR Documentation

Description

Print colorized text table

Usage

print_color_df(
  df,
  dfcolor = NULL,
  dfinvert = NULL,
  dfjustify = "centre",
  header = FALSE,
  padding = 2,
  pad_type = 1,
  comment = FALSE,
  timeStamp = FALSE,
  htmlOut = getOption("jam.htmlOut", FALSE),
  debug = FALSE,
  ...
)

Arguments

df

data.frame with content to be printed to the R console.

dfcolor

data.frame with R compatible colors in each cell.

dfinvert

data.frame with logical values indicating whether each color should be inverted TRUE so the cell color is applied as a background color. In this case the foreground text color is determined using jamba::setTextContrastColor().

dfjustify

character or data.frame passed to format() to determine the text alignment in each cell. When supplied as a vector, it describes each column of output; when supplied as a data.frame it describes each cell.

header

logical indicating whether to print column names at the top of the output.

padding

integer value that defines the number of characters added before and after each text term to add visual space between adjacent cells.

comment, timeStamp

logical arguments passed to jamba::printDebug(), which indicate whether to print output as a comment (with "#" at the start of each line), and whether to include a time stamp. The default FALSE turn these options off.

...

additional arguments are ignored.

Details

This utility function takes df as a data.frame input, and prints colorized text output.

Colors are defined using dfcolor provided as a data.frame.

Colors can be inverted using dfinvert that contains logical TRUE or FALSE values, provided as a data.frame.

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, shrink_df(), three_point_angle(), venndir_legender(), venndir_to_df()

Examples

set.seed(2);
df <- matrix(sample(head(colors(), 151), 12), ncol=3);
dfinvert <- matrix(sample(c(FALSE, FALSE, TRUE), 12, replace=TRUE), ncol=3);
print_color_df(df, df, dfinvert);

print_color_df(df, df, dfinvert, padding=1);

colnames(df) <- c("left", "centre", "right");
print_color_df(df, df, dfinvert,
   header=TRUE,
   padding=4,
   dfjustify=c("left", "centre", "right"));


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