Read text from a list of files with names matching a pattern, combine into a single output file. An error will be thrown if the output file already exists.
combine_text_files( path = ".", pattern, output_file, separator = "\n\n\n\n\n", remove_files = FALSE, all.files = FALSE, recursive = FALSE, ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE )
path | a character vector of full path names; the default
corresponds to the working directory, |
---|---|
pattern | an optional regular expression. Only file names which match the regular expression will be returned. |
output_file | Path to a file that combined files will be written to. This file will not be overwritten if it already exists. |
separator | Pattern that separates the text from the other files in the combined output. |
remove_files | If TRUE, removes each file after it is appended to the `output_file`. Defaults to FALSE. |
all.files | a logical value. If |
recursive | logical. Should the listing recurse into directories? |
ignore.case | logical. Should pattern-matching be case-insensitive? |
include.dirs | logical. Should subdirectory names be included in recursive listings? (They always are in non-recursive ones). |
no.. | logical. Should both |
In R package file management, sometimes R directory files need to be grouped into function families. This can be done by using this function to first write the group of functions to a new file.