curate_venn_labels | R Documentation |
Curate Venn labels
curate_venn_labels(
x,
type = c("sign", "color"),
curate_df = NULL,
unicode = TRUE,
blend_preset = "ryb",
split = " ",
...
)
x |
|
type |
|
curate_df |
|
unicode |
|
blend_preset |
|
split |
|
... |
additional arguments are ignored. |
This venndir utility function is used to convert a basic
directional label such as "0 1 0 -1"
suitable for display.
It can output either Unicode or non-Unicode text label,
or a corresponding color.
The input currently recognizes directional labels such as
"0 -1 1 0"
or the character labels "agreement"
, "concordant"
,
"mixed"
. Note that zeros "0"
are typically removed
before calling this function.
The input vector x
is split using strsplit()
using whitespace
delimiter by default, then each full value is matched and replaced
using "from"
in curate_df
.
When curate_df
is not supplied, default values are generated
for "from"
values: "1"
, "-1"
, "0"
, "concordant|agreement"
,
and "mixed"
. Values are matched using regular expression gsub()
however the full string must match, therefore from="1"
will only
match "1"
and will not match "-1"
.
The curate_df
must contain these three colnames:
"from"
- regular expression patterns, which will be surrounded
by "^("
and ")$"
to ensure complete match.
"sign"
- character
replacement for each value matched in "from"
when type="sign"
.
"color"
- character
R color to assign to each value matched
in "from"
, when type="color"
.
When two or more replacement values defined by curate_df[,"sign"]
are
present in one entry in x
, the values are concatenated together
with no whitespace. For example "1 1"
becomes "^^"
with no spacing.
To impose whitespace between characters, define sign=c("^ ", "v ")
to include whitespace. Any leading/trailing whitespace will be removed
afterwards.
vector
of labels or colors, based upon argument type
.
Other venndir utility:
expand_range()
,
make_color_contrast()
,
make_venn_combn_df()
,
make_venn_test()
,
match_list()
,
nudge_venndir_label()
,
print_color_df()
,
shrink_df()
,
three_point_angle()
,
venndir_legender()
,
venndir_to_df()
options("warn"=-1); # make them stop
venn_labels <- c("0 1 0 -1", "1 -1", "1 1 1", "mixed", "agreement", "1 1 0 0");
(curate_venn_labels(venn_labels, "sign"))
(curate_venn_labels(venn_labels, "sign", unicode=FALSE))
(curate_venn_labels(venn_labels, "color"))
jamba::printDebug(as.list(curate_venn_labels(venn_labels, "sign")),
collapse=", ",
fgText=as.list(curate_venn_labels(venn_labels, "color")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.