step_1_inversion: Generates a string (or table) that adequately describes a set...

Description Usage Arguments Details

Description

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.

Usage

1
2
3
4
5
step_1_inversion(items_df, all_except_infix = all_except_infix_fn_pl,
  item_numeral, threshold_for_inversion = 0.8, step_2_ellipsis,
  flag_prevent_ellipsis_on_inversion = TRUE,
  included_column_name = paste0(getOption("special_column_prefix"),
  getOption("includes_column_name")))

Arguments

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.

all_except_infix

Function that returns string that will be prefixed before inversed mode. Defaults to 'all #item_name_plural except for '. Function takes arguments: item_numeral, all_items_count, selected_items_count.

threshold_for_inversion

Minimum number of items required to show the inversion. Inversion excludes table.

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.

label_name

String with a nice name of the attribute. If specified, it will be preferred over the column name. Ignored on the first column. If empty, the name of the attribute will never be displayed.

label_name_suffix

String that will be placed immidiately after the column name. Defaults to ' '. Suggested alternative value: ': '.

included

Boolean that determines whether a given item should be included in the list. This allows for the inverted string ("all cases except for ...")

prefix

String appended before the item. Can be used to add Markdown quotes '`'

suffix

String appended behind the item. Can be used to add Markdown quotes '`'

attribute_prefix

String that will be put before the list of attributes. Defaults to '\uA0('

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 ' and\uA0'

item_comma

String that will put between items. Defaults to ', '

item_and

String that will put between the last two items. Defaults to ' and\uA0'

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: total_count, omited_count, item_numeral. Defaults to function that renders string ", and 5 more items". Possible fields: #item_count_full - number of ommited elements together with word "item" (customizable elsewhere). #item_count_full_more - number of ommited elements together with phrase "more items", like in "34 more item". #item_count_raw - just integer with number of ommited elements.

item_name

Vector of two strings that name singular and plural name of the item. Defaults to c('item','items').

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 arguments.

number_of_elements_around_ellipsis

Vector of two integers, defaults to 3, 2. First integer determines number of elements before the ellipsis, and second - after.

Details

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.


adamryczkowski/itemNaming documentation built on June 9, 2019, 11:44 a.m.