paste_noun_pp: Recombine row and column labels

View source: R/extractors.R

paste_noun_ppR Documentation

Recombine row and column labels

Description

This function recombines (unsplits) row or column labels that have been separated by split_noun_pp().

Usage

paste_noun_pp(
  splt_labels,
  notation = RCLabels::bracket_notation,
  squish = TRUE
)

Arguments

splt_labels

A vector of split row or column labels, probably created by split_noun_pp().

notation

The notation object that describes the labels. Default is RCLabels::bracket_notation.

squish

A boolean that tells whether to remove extra spaces in the output of ⁠paste_*()⁠ functions. Default is TRUE.

Value

Recombined row and column labels.

Examples

labs <- c("a [of b in c]", "d [from Coal mines in USA]")
labs
split <- split_noun_pp(labs)
split
paste_noun_pp(split)
# Also works in a data frame
df <- tibble::tibble(labels = c("a [in b]", "c [of d into USA]",
                                "e [of f in g]", "h [-> i in j]"))
recombined <- df %>%
  dplyr::mutate(
    splits = split_noun_pp(labels),
    recombined = paste_noun_pp(splits)
  )
all(recombined$labels == recombined$recombined)

RCLabels documentation built on May 29, 2024, 5:56 a.m.