Remove a prepositional phrase in a row or column label
remove_label_pieces.Rd
This function removes pieces from row and column labels.
Usage
remove_label_pieces(
labels,
pieces_to_remove,
prepositions = RCLabels::prepositions_list,
inf_notation = TRUE,
notation = RCLabels::notations_list,
choose_most_specific = FALSE
)
Arguments
- labels
The row and column labels from which prepositional phrases will be removed.
- pieces_to_remove
The names of pieces of the label to be removed, typically "noun" or a preposition such as "of" or "in" See
RCLabels::prepositions_list
for a list of known prepositions.- prepositions
A list of prepositions, used to detect prepositional phrases. Default is
RCLabels::prepositions_list
.- inf_notation
A boolean that tells whether to infer notation for
x
. Default isTRUE
. Seeinfer_notation()
for details.- notation
The notation type to be used when extracting prepositions. Default is
RCLabels::notations_list
, meaning that the notation is inferred usinginfer_notation()
.- choose_most_specific
A boolean that tells whether the most specific notation is selected when more than one notation match. Default is
FALSE
.
Examples
labs <- c("a [of b in c]", "d [-> e in f]")
remove_label_pieces(labs, pieces_to_remove = "of")
#> [1] "a [in c]" "d [-> e in f]"
remove_label_pieces(labs, pieces_to_remove = c("of", "->"))
#> [1] "a [in c]" "d [in f]"
remove_label_pieces(labs, pieces_to_remove = c("in", "into"))
#> [1] "a [of b]" "d [-> e]"
remove_label_pieces(labs, pieces_to_remove = c("of", "in"))
#> [1] "a [ ]" "d [-> e]"