label_pairs: Label pairs of parentheses.

View source: R/div.R

label_pairsR Documentation

Label pairs of parentheses.

Description

This function is the labeller for find_div_pairs()

Usage

label_pairs(pairs, n_tags, reverse = FALSE)

Arguments

pairs

a vector of parentheses.

n_tags

the number of closing tags

reverse

if TRUE, the search from the end of the stack

Value

a vector of integers indicating the pair of parentheses.

See Also

Other div: clean_div_tags(), find_between_tags(), find_div_pairs(), get_divs(), label_div_tags(), make_div(), make_div_pairs(), replace_with_div()

Examples


x <- c("(", "(", ")", ")")
pegboard:::label_pairs(x, 2)
x <- c("(", "(", ")", "(", "(", ")", ")", ")")
pegboard:::label_pairs(x, 4)

carpentries/pegboard documentation built on Nov. 13, 2024, 8:53 a.m.