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.framewith content to be printed to the R console.- dfcolor
data.framewith R compatible colors in each cell.- dfinvert
data.framewithlogicalvalues indicating whether each color should be invertedTRUEso the cell color is applied as a background color. In this case the foreground text color is determined usingjamba::setTextContrastColor().- dfjustify
characterordata.framepassed toformat()to determine the text alignment in each cell. When supplied as a vector, it describes each column of output; when supplied as adata.frameit describes each cell.- header
logicalindicating whether to print column names at the top of the output.- padding
integervalue that defines the number of characters added before and after each text term to add visual space between adjacent cells.- comment, timeStamp
logicalarguments passed tojamba::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 defaultFALSEturn 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 internal:
assemble_venndir_label(),
assign_degree_groups(),
check_systemfonts_family(),
expand_range(),
get_venn_polygon_shapes(),
make_degrees_clockwise(),
make_venn_combn_df(),
match_list(),
render_venndir_footnotes(),
shrink_df(),
simple_ellipse(),
subset_systemfonts(),
venndir_label_style(),
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);
#> darkolivegreen darkorange3 dodgerblue3
#> antiquewhite3 deepskyblue4 chartreuse3
#> firebrick3 burlywood4 darkviolet
#> azure4 darkgoldenrod chocolate3
print_color_df(df, df, dfinvert, padding=1);
#> darkolivegreen darkorange3 dodgerblue3
#> antiquewhite3 deepskyblue4 chartreuse3
#> firebrick3 burlywood4 darkviolet
#> azure4 darkgoldenrod chocolate3
colnames(df) <- c("left", "centre", "right");
print_color_df(df, df, dfinvert,
header=TRUE,
padding=4,
dfjustify=c("left", "centre", "right"));
#> left centre right
#> darkolivegreen darkorange3 dodgerblue3
#> antiquewhite3 deepskyblue4 chartreuse3
#> firebrick3 burlywood4 darkviolet
#> azure4 darkgoldenrod chocolate3