create.errorframe: Create a data frame documenting errors

Description Usage Arguments

View source: R/qaqc.R

Description

This takes a source data frame with the relevant metadata and potentially a variable to flag as an error, adds a variable with the error message, and restricts the output to only the requested variables and the error message for the entries that had errors.

Usage

1
2
create.errorframe(source.df, source.variables = NULL, error.text,
  error.vector, error.component = NULL)

Arguments

source.df

Data frame. The data frame containing the metadata entries, if relevant, the variable matching error.component to be used in creating a more specific error text string.

source.variables

Option vector of character strings. If source.df contains extraneous variables, this can be used to list the variables to keep from source.df. If NULL then all variables will be kept. Defaults to NULL.

error.text

Character string. The error message to add to the variable error in the output. This will be the same for all entries in the output data frame unless a variable is given in the argument error.component in which case the values from that variable will be added to the error text separated by " ".

error.vector

Logical vector. The logical vector used to slice source.df down to only entries in which an error occurred. TRUE values must correspond to an error occurring in source.df. The vector must be in the same order as source.df and the same length.

error.component

Optional character string matching a variable name in source.df. If provided, the values from this variable will be added to the end of the error.text string separated by a " ", allowing for more specific error text, e.g. "Invalid surface code: Rock" instead of just "Invalid surface code". Defaults to NULL.


nstauffer/dima.tools documentation built on May 20, 2019, 2:09 p.m.