Function for comparing existing output files with the memory read using runProject()

compareProjectToStoredOutputFiles(
  projectPath,
  projectPath_original = projectPath,
  emptyStringAsNA = FALSE,
  intersect.names = TRUE,
  ignore.variable = NULL,
  ignore.process = NULL,
  ignore.process.variable = NULL,
  skipNAFraction = FALSE,
  skipNAAt = NULL,
  NAReplacement = NULL,
  ignoreEqual = FALSE,
  classOf = c("first", "second"),
  try = TRUE,
  data.out = FALSE,
  sort = TRUE,
  compareReports = FALSE,
  checkOutputFiles = TRUE,
  returnBootstrapData = FALSE,
  selection = list(),
  BootstrapID = NA,
  unlistSingleTable = TRUE,
  tolerance = sqrt(.Machine$double.eps),
  debug = FALSE,
  save = FALSE,
  check.columnNames_identical = FALSE,
  testAllTRUE = FALSE,
  ...
)

Arguments

projectPath

The path to the StoX project, i.e., the folder of the project with the sub folders "input", "output" and "process". Can possibly be the path to a file inside the project folder.

projectPath_original

The project holding the existing output files, defaulted to projectPath.

emptyStringAsNA

Logical: If TRUE, read empty strings as NA from the stored original tables, as RstoxFramework has started writing NAs as NAs and not as empty strings.

intersect.names

Logical: If TRUE, compare only same named columns.

ignore.variable

Either a vector of names of variables/columns to ignore in the comparison, or a list of such variables per process (named by the process names).

ignore.process

A vector of names of processes to ignore in the comparison.

ignore.process.variable

A list of variables to ignore for different processes, named by the processes, e.g. list(MeanNASC = c("MinLayerDepth", "MaxLayerDepth"))

skipNAFraction

Logical: If TRUE, skip rows with more than 50 percent NAs. Can also be set to a numeric value between 0 and 1.

skipNAAt

A vector of strings naming the columns in which NA values identifies rows to skip. If more than one variable is given and more than one of these are present in a table, all rows where at least one of the variables are NA are skipped. Note that this may reduce the number of rows and may results in diffs for that reason. Using this option is best used in combination with mergeWhenDifferentNumberOfRows.

NAReplacement

List of replacement values for different classes of NA, applied after any merging as to incorporate NAs generated during merging.

ignoreEqual

Logical: If TRUE, ignore columns where all values are equal.

classOf

Character string specifying whether to compare after converting to the class of the first or second table. Set this to "first" (default) to convert class to the original data.

try

Logical: If FALSE do not run the process in a tryCatch. Set this to FALSE when debugging, as the tryCatch masks the errors in the traceback.

data.out

Logical, if TRUE output the original and new data along with the tests. data.out = NULL implies data.out = FALSE if no difference was found and data.out = TRUE otherwise.

sort

Logical, if TRUE sort the tables before all.equal. When mergeWhenDifferentNumberOfRows = TRUE the tables are always sorted.

compareReports

Logical, if TRUE compare the report specifically (old method kept for robustness).

checkOutputFiles

Logical, if TRUE compare the file names of the output files.

returnBootstrapData

Logical: If TRUE read the content of bootstrap NetCDF4 file.

selection

Hierarchical list of names of the groups/variables. The last element must be a vector of the variables to return from the table specified by the other elements. E.g., list("ImputeSuperIndividuals", "SuperIndividualsData", c("Stratum", "IndividualAge", "Abundance")) will return a data.table of the three columns "Stratum", "IndividualAge" and "Abundance", added the BootstrapID specified in BootstrapID.

BootstrapID

A sequence of bootstrap IDs, i.e., the indices of the bootstrap replicates. The default returns all bootstrap replicates.

unlistSingleTable

Logical: For use when only single table process outputs are among the requested processes in OutputProcesses of Bootstrap. If FALSE (default) return a list named by the selection with a sub-list named by the datatype holding the output data (e.g. $ImputeSuperIndividuals$SuperIndividualsData). If TRUE return a list named by the selection holding the output data, replicating the output of Bootstrap in StoX <= 3.6.2.

tolerance

The tolerance to use in all.equal.

debug

Logical: If TRUE, interrupt the execution just before priting the test results.

save

Logical: If TRUE save the project before closing. Default (NULL) is to ask the user whether to save the project before closing.

check.columnNames_identical

Logical: If TRUE, test that the column names are identical between corresponding tables of the original and new data.

testAllTRUE

Logical: If FALSE, only test differences between common rows between tables that are compared by merging. If TRUE the function reports test failures when the extra rows from merging wih all = TRUE contains differences.

...

Used in runModel().