This function takes sets of sources and merges them using the utterance identifiers (UIDs) to match them.

  outputPrefix = "",
  outputSuffix = "_merged",
  primarySourcesRegex = ".*",
  primarySourcesIgnoreRegex = outputSuffix,
  primarySourcesPath = input,
  recursive = TRUE,
  primarySourcesRecursive = recursive,
  filenameRegex = ".*",
  primarySourcesFileList = NULL,
  sourcesFileList = NULL,
  postponeDeductiveTreeBuilding = TRUE,
  ignoreOddDelimiters = FALSE,
  preventOverwriting = rock::opts$get(preventOverwriting),
  encoding = rock::opts$get(encoding),
  silent = rock::opts$get(silent),
  inheritSilence = FALSE



The directory containing the input sources.


The path to the directory where to store the merged sources. This path will be created with a warning if it does not exist. An exception is if "same" is specified - in that case, every file will be written to the same directory it was read from.

outputPrefix, outputSuffix

A pre- and/or suffix to add to the filename when writing the merged sources (especially useful when writing them to the same directory).


A regular expression that specifies how to recognize the primary sources (i.e. the files used as the basis, to which the codes from other sources are added).


A regular expression that specifies which files to ignore as primary files.


The path containing the primary sources.

recursive, primarySourcesRecursive

Whether to read files from sub-directories (TRUE) or not.


Only files matching this regular expression are read.

primarySourcesFileList, sourcesFileList

Alternatively to using regular expressions, lists of full paths and filenames to the primary sources and all sources to process can be specified using these arguments. If this is used, neither can be NULL.


Whether to imediately try to build the deductive tree(s) based on the information in this file (FALSE) or whether to skip that. Skipping this is useful if the full tree information is distributed over multiple files (in which case you should probably call parse_sources instead of parse_source).


If an odd number of YAML delimiters is encountered, whether this should result in an error (FALSE) or just be silently ignored (TRUE).


Whether to prevent overwriting existing files or not.


The encoding of the file to read (in file).


Whether to provide (FALSE) or suppress (TRUE) more detailed progress updates.


If not silent, whether to let functions called by merge_sources inherit that setting.


Invisibly, a list of the parsed, primary, and merged sources.