This function defines the translation table used as input to TranslateStoxBiotic and similar functions to translate values of one or more columns to new values given by a table or read from a CSV file.
DefineTranslation(
processData,
UseProcessData = FALSE,
DefinitionMethod = c("ResourceFile", "TranslationTable"),
TranslationTable = data.table::data.table(),
Conditional = FALSE,
FileName = character()
)The current data produced by a previous instance of the function.
Logical: If TRUE use the existing function output in the process.
Character: A string naming the method to use, one of "TranslationTable" for defining the TranslationTable, and "ResourceFile" for reading the table from the file given by FileName.
A table of the columns VariableName, representing the variable to translate; Value, giving the values to translate; and NewValue, giving the values to translate to. Use NA in the Value column to translate missing values (shown as "-" in View output in the StoX GUI, and usually as empty cell in excel). In the current version NAs cannot be mixed with non-NAs in the Value column. Please use a separate DefineTranslation & Translate procecss to translate NAs.
Logical: If TRUE the columns ConditionalVariableName and ConditionalValue are expected in the TranslationTable. These define a variable interacting with the VariableName and Value, so that VariableName is changed from Value to NewValue only when ConditionalVariableName has the value given by ConditionalValue. Note that ConditionalVariableName must exist in the same table as VariableName.
The csv file holding a table with the three variables listed for TranslationTable.
A Translation object.