Description Usage Arguments Details
Supports multiple object attributes (that can be used as a secondary names, like element1 (name: Bob), element2 (Charlie) and element3 (Dave)
.'
Supports Markdown formatting
Supports inverse matching, i.e. All elements except for element20 (name: Ted) and element21 (Unity)
.
Supports tables of items for really big lists.
1 2 3 4 5 6 7 8 9 | decide_inversion(items_df, field_attributes_df,
all_except_infix = "all #item_name_plural except for ",
attribute_prefix = " (", attribute_sufix = ")",
attribute_comma = ", ", attribute_and = " and ",
item_comma = ", ", item_and = " and ",
item_ellipsis = ", #item_count_full_more#, ", item_name = c("item",
"items"), max_explicit_items_count = 7,
number_of_elements_around_ellipsis = c(3, 2),
threshold_for_inversion = 0.8)
|
items_df |
A vector, data.frame or a list that will be translated into the string. List will be translated into the data.frame using lists2df. It can also be a list of two equal sized vectors, in which case first vector will give a first name, and second (if not NA) will give the alternate name, that will be displayed in braces. Names that start with underscore are ignored. Columns with names that start with underscore followed by name of the existing column are assumed to contain properties of the given column. |
field_attributes_df |
A data.frame or a list the defines properties of the items. The properties can also be input as attributes of the columns of the items, if items is a data.frame.
|
all_except_infix |
String that will be prefixed before inversed mode. Defaults to |
attribute_prefix |
String that will be put before the list of attributes. Defaults to |
attribute_sufix |
String that will be put before the list of attributes. Defaults to |
attribute_comma |
String that will put between attributes in the list of the attributes. Defaults to |
attribute_and |
String that will put between the last two attributes in the attributes' list. Defaults to |
item_comma |
String that will put between items. Defaults to |
item_and |
String that will put between the last two items. Defaults to |
item_ellipsis |
Function that will emit string that be put in place of the ommited items, when rendering in ellipsis mode. The function will get the following arguments: |
item_name |
Vector of two strings that name singular and plural name of the item. Defaults to |
max_explicit_items_count |
Maximum number of explicit items. -1 is infinity. If number of items in the items_df exceeds that number, function will use
the ellipsis. Must be bigger than sum of |
number_of_elements_around_ellipsis |
Vector of two integers, defaults to |
threshold_for_inversion |
Minimum number of items required to show the inversion. Inversion excludes table. |
Produced string will have a format
First item[[<attribute_prefix>Attribute 1 with name]<attribute_comma>|<attribute_and>Attribute 2 with name... <attribute_sufix>]<item_comma>|<item_and>|<item_ellipsis>Second item[...]...
where attribute_prefix
, attribute_comma
, attribute_and
, attribute_sufix
, item_comma
, item_and
and item_ellipsis
are arguments to the function.
Each item and its attributes share additional arguments, that are input using the field_attributes_df
data frame.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.