View source: R/shorten_condition.R
| shorten_condition | R Documentation |
This function takes a character vector of conditions and shortens the predicates within each condition according to a specified method.
shorten_condition(x, method = "letters")
x |
A character vector of conditions, each formatted as a string
(e.g., |
method |
A character scalar specifying the shortening method. Must be
one of |
Each element of x must be a condition formatted as a string, e.g.
"{a=1,b=100,c=3}" (see format_condition()). The function then
shortens the predicates in each condition based on the selected method:
"letters": predicates are replaced with single letters from the
English alphabet, starting with A for the first distinct predicate;
"abbrev4": predicates are abbreviated to at most 4 characters using
base::abbreviate();
"abbrev8": predicates are abbreviated to at most 8 characters using
base::abbreviate();
"none": no shortening is applied; predicates remain unchanged.
Predicate shortening is useful for visualization or reporting, especially
when original predicate names are long or complex. Note that shortening is
applied consistently across all conditions in x.
A character vector of conditions with predicates shortened according to the specified method.
Michal Burda
format_condition(), parse_condition(), is_condition(),
remove_ill_conditions(), base::abbreviate()
shorten_condition(c("{a=1,b=100,c=3}", "{a=2}", "{b=100,c=3}"),
method = "letters")
shorten_condition(c("{helloWorld=1}", "{helloWorld=2}", "{c=3,helloWorld=1}"),
method = "abbrev4")
shorten_condition(c("{helloWorld=1}", "{helloWorld=2}", "{c=3,helloWorld=1}"),
method = "abbrev8")
shorten_condition(c("{helloWorld=1}", "{helloWorld=2}"),
method = "none")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.