post_process_extract_chunks: Extract chunks of lines from a vector of lines

View source: R/post-process-extract-chunks.R

post_process_extract_chunksR Documentation

Extract chunks of lines from a vector of lines

Description

Extract chunks of lines from a vector of lines

Usage

post_process_extract_chunks(x, beg_inds, end_inds)

Arguments

x

Tex code, as a vector of lines read in from a TeX file by

beg_inds

A vector of beginning indices for the chunks to extract. Must be the same length as end_inds

end_inds

A vector of ending indices for the chunks to extract. Must be the same length as beg_inds

Details

Creates two lists of slices of the input vector, the first list will contain the slices between beg_inds and end_inds. The second list will contain the slices NOT between beg_inds and end_inds. If the first element of beg_ind is 1, then the return flag first will be set to TRUE. If the first element of beg_ind is not a 1, the return flag first will be set to FALSE. If the difference between an end_inds value and the corresponding next beg_inds value, a line with an empty string will be placed between them so that the interlacing between the two lists remains perfect, so they 'zipper' together 1 after the other.

Value

A list of three elements, the first being the list of vectors which are 'in-between' the beg_inds and end_inds values. The second is a list of vectors which are 'between' the beg_inds and end_inds values. the third is first which is explained above in ⁠@details⁠

Examples

library(hake)
k <- extract_chunks(letters, c(2, 10), c(9, 12))

pacific-hake/hake-assessment documentation built on Jan. 14, 2025, 9:12 p.m.