merge_sources: Merge source files by different coders

View source: R/merge_sources.R

merge_sourcesR Documentation

Merge source files by different coders

Description

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

Usage

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

Arguments

input

The directory containing the input sources.

output

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).

primarySourcesRegex

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).

primarySourcesIgnoreRegex

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

primarySourcesPath

The path containing the primary sources.

recursive, primarySourcesRecursive

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

filenameRegex

Only files matching this regular expression are read.

postponeDeductiveTreeBuilding

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).

ignoreOddDelimiters

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

preventOverwriting

Whether to prevent overwriting existing files or not.

encoding

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

silent

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

inheritSilence

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

Value

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


rock documentation built on Dec. 28, 2022, 1:55 a.m.