
Combine split chapter chunk files
Source:R/combine_split_chapter_files.R
combine_split_chapter_files.RdCombines text files named with page/range suffixes such as
3_part1-001-050.txt, 3_part1-051-100.txt, and
3_part1-101-138.txt into a single 3_part1.txt file. Files without a
trailing -start-end range are copied to output_dir when needed.
Usage
combine_split_chapter_files(
input_dir,
output_dir = input_dir,
extension = "txt",
separator = "\n\n",
overwrite = FALSE,
remove_sources = FALSE
)Arguments
- input_dir
Character scalar. Folder containing chapter
.txtfiles.- output_dir
Character scalar. Folder where consolidated files should be written. Defaults to
input_dir.- extension
Character scalar file extension to match, without a leading dot by default. Defaults to
"txt".- separator
Character scalar. Text inserted between chunks when combining them. Defaults to two line breaks.
- overwrite
Logical scalar. If
TRUE, replace existing output files. Defaults toFALSE.- remove_sources
Logical scalar. If
TRUE, remove split source chunk files after all outputs are written successfully. Defaults toFALSE.