DefineTranslation: Define translation

Description Usage Arguments Value

View source: R/DefineAndUpdateVariables.R

Description

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.

Usage

1
2
3
4
5
6
7
8
DefineTranslation(
  processData,
  UseProcessData = FALSE,
  DefinitionMethod = c("ResourceFile", "TranslationTable"),
  TranslationTable = data.table::data.table(),
  Conditional = FALSE,
  FileName = character()
)

Arguments

processData

The current data produced by a previous instance of the function.

UseProcessData

Logical: If TRUE use the existing function output in the process.

DefinitionMethod

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.

TranslationTable

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.

Conditional

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.

FileName

The csv file holding a table with the three variables listed for TranslationTable.

Value

A Translation object.


RstoxData documentation built on July 17, 2021, 5:08 p.m.