Skip to contents

This function modifies the nouns of row and column labels. The length of new_nouns must be the same as the length of labels.

Usage

modify_nouns(
  labels,
  new_nouns,
  inf_notation = TRUE,
  notation = RCLabels::notations_list,
  choose_most_specific = FALSE
)

Arguments

labels

The row and column labels in which the nouns will be modified.

new_nouns

The new nouns to be set in labels. Must be same length as labels.

inf_notation

A boolean that tells whether to infer notation for labels. Default is TRUE. See infer_notation() for details.

notation

The notation type to be used when extracting prepositions. Default is RCLabels::notations_list, meaning that the notation is inferred using infer_notation().

choose_most_specific

A boolean that tells whether to choose the most specific notation from notation when inferring notation. Default is FALSE so that a less specific notation can be inferred. In combination with RCLabels::notations_list, the default value of FALSE means that RCLabels::bracket_notation will be selected instead of anything more specific, such as RCLabels::from_notation.

Value

A character vector of same length as labels with nouns modified to be new_nouns.

Examples

labels <- c("a [of b in c]", "d [of e in USA]")
modify_nouns(labels, c("a_plus", "g"))
#> [1] "a_plus [of b in c]" "g [of e in USA]"